From the course: Docker: Build and Optimize Docker Images

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Challenge: Optimizing a Dockerfile

Challenge: Optimizing a Dockerfile - Docker Tutorial

From the course: Docker: Build and Optimize Docker Images

Challenge: Optimizing a Dockerfile

(upbeat music) - [Instructor] It is time for another challenge. In this challenge, you'll optimize a Dockerfile to reduce the number of layers created by the builder and speed up build times. Here are your challenge tasks. In the code branch for this video, I've added a new Dockerfile dot optimize file. In this file, I want you to combine run instructions that are related to each other. Here's a tip. You should have two run instructions when you're finished. Think about grouping together run instructions that depend on one another, such as creating users in groups. Build the image and tag it. Username slash docker image demo and version 2.3.4. To incorporate these changes. Use the F flag to specify you're using the docker file dot optimize file and not the regular docker file. For example, after the docker build command, add the F flag and then specify dockerfile dot optimize. This can go before or after you tag the image using the T flag. For extra credit, run a container to test…

Contents