Create container application images
A container image is a layered executable software package used to build and run a containerized application. We can use a WebSphere Liberty container image to build an application image.
Steps
- Choose a base container image.
We can choose from several preconfigured Liberty container images. The kernel tag provides a minimum server. We can include features on the server for the application by including the RUN features.sh command. Liberty features are downloaded from the Maven Central repository by default.
-
remoteRepo.url=https://my-remote-server/secure/maven2
remoteRepo.user=operator
remoteRepo.password={aes}KM8dhwcv892Ss1sawu9R+We can specify alternatives using the file...
-
/opt/ibm/wlp/etc/featureUtility.properties
- Set up a Dockerfile template for the application image.
The following example Dockerfile template specifies the kernel-java8-openj9-ubi WebSphere Liberty container image in the FROM directive.
- FROM icr.io/appcafe/websphere-liberty:kernel-java8-openj9-bi
# Default setting for the verbose option. Set it to true to debug the application container image build failures
ARG VERBOSE=false
# Add Liberty server configuration including all necessary features
COPY --chown=1001:0 server.xml /config/
# Modify feature repository (optional)
COPY --chown=1001:0 featureUtility.properties /opt/ibm/wlp/etc/
# This script will add the requested XML snippets to enable Liberty features and grow the image to be fit-for-purpose using featureUtility.
RUN features.sh
# Add interim fixes (optional)
COPY --chown=1001:0 interim-fixes /opt/ibm/fixes/
# Add application COPY --chown=1001:0 Sample1.war /config/dropins/
# This script will add the requested server configurations, apply any interim fixes and populate caches to optimize runtime RUN configure.shA template like this creates an image that adds a single application and the corresponding configuration. Do not configure the container manually after it is started, except for debugging purposes. Configuration changes made to the container are not reflected in new containers created from the image.
We now have a container image containing both the application and its configuration, which means we can create new, fully configured containers at any time.
- Liberty container images
- Optional enterprise functions for WebSphere Liberty runtime images
- Configure security for applications in containers
- Implementing the OpenJ9 shared class cache for applications in containers
- Set up logging for WebSphere Liberty container images
- Set up session caching for applications in containers
- Install WebSphere Liberty features from a local repository
- Faster startup for containerized applications with Liberty InstantOn
Parent: