...

/

Images and Layers

Images and Layers

Explore the contents of Docker images and their layers.

As already mentioned, Docker images are a collection of loosely connected read-only layers where each layer comprises one or more files. The figure below shows an image with four layers. Docker takes care of stacking them and representing them as a single unified image.

Press + to interact
A Docker image with stacked layers
A Docker image with stacked layers

Inspecting layers

Let’s look at all of the following ways to inspect layer information:

  • Pull operations
  • The docker inspect command
  • The docker history command

Run the following command to pull the node:latest image and observe it pulling the individual layers. Some newer versions may have more or less layers, but the principle is the same.

$ docker pull node:latest
latest: Pulling from library/ubuntu
952132ac251a: Pull complete
82659f8f1b76: Pull complete
c19118ca682d: Pull complete
8296858250fe: Pull complete
24e0251a0e2c: Pull complete
Digest: sha256:f4691c96e6bbaa99d...28ae95a60369c506dd6e6f6ab
Status: Downloaded newer image for node:latest
docker.io/node:latest
Pulling a Docker image

Each line ending with Pull complete represents a layer that Docker pulled. This ...