How to Show All Layers of a Docker Image

Tyler Tyler (291)
5 minutes

Docker images are made up of layers, and many times you'll want to see details on each layer of an image. This guide will show you how to show all layers of a Docker image.

Posted in these interests:
h/docker12 guides

As an example, we'll check out the layers of the python:3.6 image. So first run:

docker pull python:3.6

And use docker history to show the layers.

docker history python:3.6

The output of this command will show you details about how each layer was created and the size:

IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
a5b7afcfdcc8        2 months ago        /bin/sh -c #(nop)  CMD ["python3"]              0B
<missing>           2 months ago        /bin/sh -c set -ex;   wget -O 'ht…   6MB
<missing>           2 months ago        /bin/sh -c #(nop)  ENV PYTHON_PIP_VERSION=10…   0B
<missing>           2 months ago        /bin/sh -c cd /usr/local/bin  && ln -s idle3…   32B
<missing>           2 months ago        /bin/sh -c set -ex  && buildDeps='   dpkg-de…   67.3MB
<missing>           2 months ago        /bin/sh -c #(nop)  ENV PYTHON_VERSION=3.6.5     0B
<missing>           2 months ago        /bin/sh -c #(nop)  ENV GPG_KEY=0D96DF4D4110E…   0B
<missing>           2 months ago        /bin/sh -c apt-get update && apt-get install…   8.73MB
<missing>           2 months ago        /bin/sh -c #(nop)  ENV LANG=C.UTF-8             0B
<missing>           2 months ago        /bin/sh -c #(nop)  ENV PATH=/usr/local/bin:/…   0B
<missing>           2 months ago        /bin/sh -c set -ex;  apt-get update;  apt-ge…   556MB
<missing>           2 months ago        /bin/sh -c apt-get update && apt-get install…   142MB
<missing>           2 months ago        /bin/sh -c set -ex;  if ! command -v gpg > /…   7.8MB
<missing>           2 months ago        /bin/sh -c apt-get update && apt-get install…   23.2MB
<missing>           3 months ago        /bin/sh -c #(nop)  CMD ["bash"]                 0B
<missing>           3 months ago        /bin/sh -c #(nop) ADD file:9572fdb59dfbb9b03…   101MB
Tyler Tyler (291)

In this short guide, we'll learn how to install Docker Engine on any platform. Before we begin, we should make the distinction between Docker Engine (Enterprise) and Docker Engine (Community).