Learn how to modularize your Java EE applications using Docker. In this second part of their series on Docker and Java EE, Bruno Souza, Elder Moraes, and André Carvalho explore a simple process for using Docker containers to provide all the services a Java EE application requires.
As the authors point out, software containers can help you manage and tame the complexity of providing services for expandable infrastructures. Containers make it easy to create complex infrastructures that are composed of many moving parts. Containers can also help with automation, and they can ease the creation of complete development-test-deploy pipelines. And, perhaps best of all, containers allow for the reuse of infrastructure components in multiple projects and environments.
The article describes taking an existing application and reworking it so that all the required services are provided through containers.
The seven steps described in this article are:
1. Start from your own Java EE application.
2. List all the services you are using now: application server, database, message queue, and so on.
3. Docker Hub may have ready-to-use images for some or all those services. Do a search there, read about the images; look for the ones that are suitable for your project.
4. Consider defining your own image. You might need to if there is no suitable image for a service or your application requires extensive configuration.
5. Either use the images directly (such as Cassandra and ActiveMQ in our example) or start from an existing image and add your customizations (as we did with the PostgreSQL image).
6. Start your containers to get your services up and running.
7. Create the container for your application. Remember to link it to the service containers. This will allow the containers to communicate. See the requirements of your orchestration platform.
Get a full understanding of the process by reading the article.
In Part 1 Step-by-Step High Availability with Docker and Java EE, Bruno Souza and Elder Moraes describe how to combine Java EE and Docker to develop and deploy portable, scalable, highly-available services.