Get how many layers your Docker image is composed of

To know how many layers your image is composed of, and how large they are, run the docker history command, as in the following example:

$ docker history docker-bp
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
35536d376bab        4 days ago          /bin/sh -c #(nop)  CMD ["nginx" "-g" "daemon…   0B                  
f555329ef265        4 days ago          /bin/sh -c #(nop) COPY dir:7be492d9e6b762086…   225B                
1915735df6e5        4 days ago          /bin/sh -c #(nop) COPY file:6883710475eaef4d…   182B                
fb60981a374a        4 days ago          /bin/sh -c #(nop)  EXPOSE 80                    0B                  
f6500d006555        4 days ago          /bin/sh -c apk add --no-cache --repository h…   1.41MB              
599206500cb5        4 days ago          /bin/sh -c #(nop)  ENV NGINX_VERSION=1.16.1-…   0B                  
a187dde48cd2        9 months ago        /bin/sh -c #(nop)  CMD ["/bin/sh"]              0B                  
<missing>           9 months ago        /bin/sh -c #(nop) ADD file:0c4555f363c2672e3…   5.6MB
For each layer you can see:
  • The layer’s unique hash
  • When that layer was created
  • The command that created it
  • The layer’s size