0
0
DockerHow-ToBeginner · 3 min read

How to See Image History in Docker: Command and Examples

Use the docker history IMAGE_NAME command to see the history of a Docker image. This shows all layers, their sizes, and creation commands in order.
📐

Syntax

The basic syntax to view the history of a Docker image is:

  • docker history IMAGE_NAME: Shows the history of the specified image.
  • IMAGE_NAME can be the image ID or the image tag.
bash
docker history IMAGE_NAME
💻

Example

This example shows how to view the history of the official nginx image.

bash
docker history nginx:latest
Output
IMAGE CREATED CREATED BY SIZE COMMENT f7bb5701a7a4 2 weeks ago /bin/sh -c #(nop) CMD ["nginx" "-g" "daemon off;"] 0B <missing> 2 weeks ago /bin/sh -c #(nop) STOPSIGNAL SIGQUIT 0B <missing> 2 weeks ago /bin/sh -c #(nop) EXPOSE 80 0B <missing> 2 weeks ago /bin/sh -c #(nop) ENTRYPOINT ["docker-entrypoint.sh"] 0B <missing> 2 weeks ago /bin/sh -c #(nop) COPY file:... in /usr/share/nginx/html 1.24kB <missing> 2 weeks ago /bin/sh -c #(nop) LABEL maintainer=NGINX Docker Maintainers <docker-maint@nginx.com> 0B <missing> 2 weeks ago /bin/sh -c #(nop) CMD ["bash"] 0B <missing> 2 weeks ago /bin/sh -c #(nop) ARG NGINX_VERSION 0B <missing> 2 weeks ago /bin/sh -c #(nop) ARG NJS_VERSION 0B <missing> 2 weeks ago /bin/sh -c #(nop) ARG PKG_RELEASE 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.title=nginx 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.authors=NGINX Docker Maintainers <docker-maint@nginx.com> 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.vendor=NGINX 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.version=1.21.6 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.created=2022-06-01T00:00:00Z 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.revision=abcdef1234567890 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.source=https://github.com/nginx/nginx 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.documentation=https://nginx.org/en/docs/ 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.licenses=BSD-2-Clause 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.ref.name=latest 0B <missing> 2 weeks ago /bin/sh -c #(nop) LABEL org.opencontainers.image.base.name=debian:buster-slim 0B <missing> 2 weeks ago /bin/sh -c #(nop) FROM debian:buster-slim 0B
⚠️

Common Pitfalls

Not specifying the correct image name or tag: If you use a wrong or misspelled image name, Docker will return an error or no history.

Using image ID vs tag: Sometimes images have multiple tags; using the image ID ensures you see the exact image history.

Expecting detailed commands for all layers: Some layers show <missing> or minimal info because of how images are built or squashed.

bash
docker history wrongimagename
# Error: No such image: wrongimagename

docker history nginx:latest
# Shows full history of the nginx image
📊

Quick Reference

Use these tips when checking Docker image history:

  • Always specify the exact image name or ID.
  • Use docker images to list available images and their tags.
  • Combine with --no-trunc to see full command details.
  • Use docker history --format to customize output.

Key Takeaways

Use docker history IMAGE_NAME to see all layers and commands of a Docker image.
Specify the correct image name or ID to avoid errors or empty results.
Layer details may show <missing> if information is not available.
Use docker images to find image names and tags before checking history.
Add --no-trunc to see full command details in the history output.