Member-only story

Layers of Docker Image101 explained

Park Sehun
3 min readAug 9, 2023

Docker images are built from a set of instructions written in a Dockerfile. Each instruction in the Dockerfile adds a new “layer” to the image, with each layer representing a change to the image, or a difference from the layer before it. This layered approach is one of the key features of Docker, and it enables much of Docker’s functionality.

From your dockerfile, the layers of command are not modifiable. Then each container will have its own writable layer. This writable layer is often referred to as the container’s “read/write layer” or “container layer.” It allows any modifications made within the container to be isolated and stored separately from the underlying image.

For instance, if there are three commends like below

FROM ubuntu
RUN dd if=/dev/zero of=/root/file1.txt bs=1M count=10
RUN dd if=/dev/zero of=/root/file2.txt bs=1M count=10
  1. The first line will create the Ubuntu base image: 70MB
  2. The second layer will add the files with 10MB: A total: 80MB
  3. The third layer will add the files with 10MB: A total: 90MB

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

No responses yet

Write a response