Back in July we announced Java EE 7 support with¬†WAS Liberty 184.108.40.206. We’ve now made it easy for Docker users to get hold of those features by releasing new images in our websphere-liberty repository on Docker Hub.
docker pull websphere-liberty will now get you an image that contains all of the features required for Java EE 7 Full Profile compliance. This image is also available by explicitly using the tag
docker pull websphere-liberty:javaee7. If you only need the web profile features, then you can use the tag¬†
webProfile7. If your application still needs the Java EE 6 features from the runtime JAR that were available in the old Docker Hub image, then you should switch to using the¬†
webProfile6 tag. The hierarchy of the images is shown in the following figure:
As you might expect, the¬†kernel image contains just the WAS Liberty kernel. The¬†common image builds on this and¬†adds a base set of features that we expect most users will require, e.g. SSL. This nested hierarchy means that, even if you’re running containers that use a mixture of base images, you’ll get maximum sharing of the features in the Docker layers. Another advantage of having the¬†kernel image is that it makes it super-easy to build your own image with a custom set of features from the online repository. For example, if I have a microservice that only needs JAX-RS, I simply create a¬†
server.xml that only specifies that feature and then write¬†a Dockerfile as follows:
FROM websphere-liberty:kernel COPY server.xml /opt/ibm/wlp/usr/servers/defaultServer/ RUN installUtility install --acceptLicense defaultServer
When built,¬†installUtility will download and install just the features that are needed by the¬†
server.xml. (For those familiar with Liberty’s¬†minify capability, using¬†installUtility¬†to build up from the kernel image is a better fit with Docker as it means we don’t risk burning features in to image layers that are not needed in the final image.) The following video demonstrates using this capability to build a custom image for the DayTrader sample:
While I have your attention, it’s worth pointing out that the WAS Liberty images on Docker Hub currently use the community¬†
java:jre image as their starting point. This means that you’re getting Open JDK rather than the IBM JRE. We’re hoping that geographical export controls will be implemented in Docker Hub later¬†this month so that we can switch back to using the IBM JRE as the default. In the meantime, the¬†
ibmjre branch in the WASdev
ci.docker GitHub project has Dockerfiles which you can use to build an image of your own with the IBM JRE.