Docker and CI/CD · Middle · Question 4 of 75

Why does RUN rm -rf /tmp/build in a later layer not shrink the image?

Explanation

Layers are additive. Clean up in the same RUN that created the files, or use a multi-stage build so temporary files never reach the final image.

Further reading

Problem with a question

Docker and CI/CD · Middle · question 4

Test yourself

Take the Docker and CI/CD · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz