12 Running Java in Containers

 

This chapter covers

  • Why container driven development is important for the well-grounded Java developer
  • The difference between an OS, a VM, a Container and Orchestration
  • Docker
  • Kubernetes
  • Practical guidance on running Java workloads in containers
  • Performance and Observability in containers

Docker containers have become the defacto standard for packaging up Java applications for deployment and Kubernetes (k8s) is the most popular option for orchestrating those containers. Especially if you are deploying to any of the major cloud providers then you will need to know about these technologies and more importantly how Java behaves with them!

[Note]  Note

Although other container and container orchestration technologies exist, Docker and Kubernetes dominate the container and orchestration markets, respectively.

12.1 Why containers matter for a well-grounded developer

To better understand what containers are and why they are important for a well-grounded Java developer we will look at the following:

  • Host Operating System vs Virtual Machines vs Containers.
  • Benefits of Containers
  • Drawbacks of Containers

12.1.1 Host Operating Systems vs Virtual Machines vs Containers

Since the early days of computing, we’ve been introducing layers of abstraction between our software and the hardware that it runs on. Containers are another natural step in this progression. Let’s take a brief tour through these layers to see how containers fix in.

Bare Metal

12.1.2 Benefits of Containers

12.1.3 Drawbacks of Containers

12.2 Docker Fundamentals

12.2.1 Building Docker images

12.2.2 Running Docker containers

12.3 Developing Java Applications with Docker

12.3.1 Selecting your base image

12.3.2 Building an image with Gradle

sitemap