Now that we have a simple, but functional Java microservice based on Spring Bootstrap, we can go further. Before we deploy it using Kubernetes, let's package it as a Docker image. In this chapter, we will create a Docker image containing our application, and we will dockerize a Spring Boot application to run it in an isolated environment, a container.
Topics covered in this chapter will be:
- Creating a Dockerfile
- Dockerfile instructions
- Building the image
- Creating and removing images
Let's begin with the definition of a Dockerfile, which will be the definition of our container.