For the purpose of our example, we will start with a simple hello-world type Spring Boot application. We are going to run in on top of official Java image: openjdk
. If you prefer to run it on the Oracle Java image, you can search for it in the DockerHub registry. There are a lot of images that are ready to use, some of them are based on the official images, such as Ubuntu for example. As we saw in Chapter 6, Creating Images, it's always good to pick an official image as the base image. Official images are tested, supported, and usually of very high quality. The basic steps for creating Java application in the container are:
Using a base image pulled out from the Docker Hub
Installing the application itself, it will be an executable jar file in our case
Exposing ports, if your application needs to communicate with the outside world using a network
Running the container
Of course, if you would like to put another kind of application in the container,...