Linux Labs

Containers: Docker and compose / Stage 4 of 11

Dockerfile: your own image

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 7 · summary · 2 min

Summary

  • An image is built from a Dockerfile with docker build; COPY puts a copy of a file from the build context into the image.
  • Each instruction is an image layer, and docker history lists the layers; a tag is a version name, and a build moves it to the new image.
  • The cache takes a step ready-made as long as the step itself, the steps above it and the files for COPY have not changed; after a changed step everything below runs again.
  • The edit at the start of the lesson did not reach the site: the container served the copy of index.html from the site:1 image, and docker restart does not change it — it takes a new image and a new container from it.
Ubuntu 24.04
Loading…