Skip to content
Theory · Dockerfile, layers and the cache · lesson 1 of 8

A first Dockerfile

Three transparencies FROM, RUN and COPY on a projector; the middle one is redrawn, and the top one with it

Remember the overhead projector — the one a teacher lays transparent sheets on. The bottom sheet holds a map, the next one rivers, the top one city names. The screen shows one picture, though it is drawn on three sheets. A Docker image works the same way: it is a stack of layers, each lying on top of the ones before it.

In this lesson

  • The Dockerfile line by line
  • Build time and run time
  • The build context
  • Build and run
  • Common mistake
  • Key points