Open Liberty is a lightweight Jave runtime that supports many modularized features. It is modularized and Docker friendly. It supports the full J2EE 8 Spec including, JNDI, JAX-WS/RS, and Spring Boot.
There are several variants of Open Liberty Docker containers available on DockerHub. The tags indicate what features are pre-installed. The
kernel tag contains only the Liberty kernel; additional components are automatically downloaded from the online repository based on the contents of the
kernel image is recommended as the basis for custom images, several other tags are available. There is also a
full tag that enables all available components.
The remainder of the available tags is various permutations of the base operating system and the JDK. A complete list can be found at this location on Dockerhub. For the most part, IBM Liberty and Open Liberty interchanged with each other with no code or configurations modifications.
- MP_HEALTH_CHECK - Monitor the server runtime environment and application metrics by using Liberty features mpMetrics-1.1
- MP_MONITORING Check the health of the environment using Liberty feature mpHealth-1.0
- HTTP_ENDPOINT - Add configuration properties for an HTTP endpoint.
- TLS - Enable Transport Security in Liberty by adding the transportSecurity-1.0 feature
- IIOP_ENDPOINT - Add configuration properties for an IIOP endpoint.
- JMS_ENDPOINT - Add configuration properties for an JMS endpoint.
- VERBOSE - When set to true it outputs the commands and results to stdout from configure.sh
Complete documentation of these options is available on GitHub.
Creating the Image
The most straightforward possible image can be created by extending the
full tag and adding your application to the
Dockerfile will create a Liberty server that uses the javaee-8 profile and will configure the application based on the settings that we pass in.
The image runs the user as
10001, so we have to make sure all files copied into the container have the proper permissions such that Liberty can read them.
The server.xml used for the full profile is generated below based on the above
If the out-of-the-box
server.xml shown below is not adequate, you may customize it and add it to the container
In addition, you may compartmentalize your
server.xml by including other XML files. Update the server.xml with an include block and
ADD the file in your docker container.
You can also include environment variable references in your
Starting the Server.
If you would like to skip all the autoconfiguration magic simply make sure to supply a
server.xml and add the following
RUN command to your Dockerfile.
CMD element from the base
If for some reason you need to do additional work before the app server starts you can simply replace this line in your
Dockerfile with a shell script that ultimately calls the server run.
Last modified on 2020-08-16