How to Show All Layers of a Docker Image
Share
Interests
Posted in these interests:
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.
1 – Use the docker history command
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
2 – Analyze the output
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 get-pip.py '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