Show Layers of Docker Image

Every speaking opportunity is a learning lesson, and hence a new opportunity to share. This blog will address one of the questions that has been bothering me for the past few days. It is about how to show different layers of Docker image, and their sizes, after it is downloaded.

Docker Logo

I was invited to talk about Docker for Java developers at Peru JUG this morning. The recording is now available:

The real content starts from 5:27.

Lets address the question now.

Each Docker image consists of a series of layers. Here is a quote from

Each image consists of a series of layers. Docker makes use of union file systems to combine these layers into a single image. Union file systems allow files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system.

How does a Docker image work?

The exact size of the image can be easily seen using docker images:

The command to show different layers, and their size, is docker history:

This command shows different layers, command used for each layer, and the exact size of each image.

The corresponding Dockerfile for this image is at

Now I can compare the Dockerfile with the exact size and easily find which image layers are the biggest. For example, biggest contributors in this Couchbase image are shown below:

  • Ubuntu from Dockerfile 12.04 is 135.9 MB
  • apt-get from Dockerfile causes another 23.57 MB
  • Couchbase server is 212 MB

--no-trunc can be specified as an additional CLI option to history to show the complete command executed to build the layer.

As always, the latest slides are available at

Be Sociable, Share!
  • Tweet

10 thoughts on “Show Layers of Docker Image

  1. Pingback: Show Layers of Docker Image | Dinesh Ram Kali.
  2. Great article. I would also suggest checking out from Century Link. It is a graphical representation of the layers and you can actually compare the layers side-by-side. I use this quite often to visualize what’s changed with upgrades.

  3. Brian,

    Thanks for sharing the link! Its not able to find jboss/wildfly image. Any idea?

  4. Currently you have JavaScript disabled. In order to post comments, please make sure JavaScript and Cookies are enabled, and reload the page. Click here for instructions on how to enable JavaScript in your browser

  5. I am examining an image (“python:3.5.3-slim”) built by a colleague who has left the company, trying to determine if it originated at dockerhub, and therefore may contain malware. When I run “docker history python:3.5.3-slim”, I get a listing whose bottom line is

    10 months ago /bin/sh -c #(nop) ADD file:a023a99f7d01868… 123 MB

    Is there any way to determine what this layer is, or where it came from?

    In your example, you explain that the bottom line is Ubuntu, and indeed we can see that in the linked Dockerfile, but would there be any way to reconstruct that without having the Dockerfile in hand?

  6. In order to increase your knowledge regarding password manager microsoft edge you may use remember passwords in microsoft edge which will help you to get rid of all your hurdle and will also help you to have exact path for the same.

  7. I wrote a simple tool for Windows to do image tree view and other stuff, maybe someone also finds it useful

  8. In my opinion, advices from will be useful for students in college. It will help you to travel cheap

Leave a Reply

Your email address will not be published. Required fields are marked *