While some developers prefer command line tools, I often use graphical tools if available since I cannot memorize all the different commands. That’s why I tried the relative new Docker Tooling for Eclipse. The plugin is relative new and there is certainly room for improvements but it helps with managing images and containers, e.g. running containers and creating images. Below is a simple sample how to use the tooling to create a Liberty based image with a hello world app that can be deployed to Bluemix.
Since the end of last year the Liberty profile is on Docker Hub. The Liberty Profile image is supplied for IBM Containers. You can use this image to build your application Java-based war files in a Liberty container.
The hello world sample contains one html file on the context root “/”.
There is also a servlet on the path “Servlet”.
The context root “/” is defined in ibm-web-ext.xml.
The sample uses Maven to build the project and create a war file.
The Maven install can be triggered from the Eclipse IDE.
The following Dockerfile is a very simple sample. Read the documentation for more options.
Via the Docker Tooling you can refer to the Dockerfile to create a new image.
Based on the image you can run containers. In the sample I used all defaults, e.g. the port mappings.
To find out the URL to invoke your deployed app on Docker open the ports section. The 0.0.0.0 needs to be replaced with your Docker ip address. You can find it out via “boot2docker ip”. Since I don’t want to do this over and over I created an entry in my host file for “dockerhost”. To run the sample app with the context root “/” simply invoke “http://dockerhost:yourport”.