From the course: Docker: Build and Optimize Docker Images

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Solution: Working with the build cache

Solution: Working with the build cache - Docker Tutorial

From the course: Docker: Build and Optimize Docker Images

Solution: Working with the build cache

(cheerful music) - [Instructor] For this challenge, you are tasked with building images, using options to leverage the build cache. Let's walk through how I'd solve this challenge. First, I asked you to build the image for our project from scratch and tag it as Docker-image-demo2.3.3. You can do this using the Docker build command with the no cache option. Then add the T flag and the name of your image, which is your username/docker-image-demo:2.3.3 . Docker will re-execute every Dockerfile instruction from scratch, ignoring any existing cached layers. Next, I ask you to build the image again and pull in the latest changes from the base image and use the same image tag from the previous task. This can be done using the docker build command and the pull option. Then add the T flag and the name and version of the image, which is the same as the previous task. The pull flag makes Docker fetch the latest version of each from image before starting the build. This will ensure that your base…

Contents