Docker basics

Lesson 02 · 13 min

Dockerfile: layers, cache and instructions

How Docker builds an image, why the order of lines decides build speed, and which instruction to use when.

13 minLesson 2 of 5Practice includedAsk AI on any point

A Dockerfile is the recipe for an image. Every instruction that changes files (RUN, COPY, ADD) creates a new layer. Layers stack on top of each other, and the image is that stack. Instructions like ENV, EXPOSE, CMD only change metadata.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.