Docker is powerful and simple to use. Docker allows developers to create portable, self-contained images for the software they create. These images can be reliably and repeatably deployed. You can get a lot of value out of Docker very easily, but to get the most out of Docker there are some concepts that are important to understand. How you build your Docker image has a measurable impact when you are doing continuous integration and continuous delivery. In this article, I will focus on how to take a more efficient approach to building Docker images for Spring Boot applications when doing iterative development and deployment. The standard approach has some drawbacks so here we look at what they are and how to do it better.

Key Docker Concepts

There are four key Docker concepts at play: images, layers, the Dockerfile and the Docker cache. Simply put, the Dockerfile describes how to build the Docker image. An image consists of a number of layers. The Dockerfile starts with a base image and adds on additional layers. A new layer is generated when new content is added to the image. Each layer that is built is cached so it can be re-used on subsequent builds. When a Docker build runs, it will re-use any existing layers that it can from the cache. This reduces the overall time and space needed for each build. Anything that has changed, or has not been built before, will be built as needed.

Source de l’article sur DZONE