[Docker CLI] docker history

docker history

Show the history of an image

Prerequisites

Usage

1
$ docker history [OPTIONS] IMAGE

For example uses of this command, refer to the examples section below.

Options

1
2
3
4
5
Name, shorthand	Default	Description
--format Pretty-print images using a Go template
--human , -H true Print sizes and dates in human readable format
--no-trunc Don't truncate output
--quiet , -q Only show image IDs

Examples

To see how the docker:latest image was built:

1
2
3
4
$ docker history docker
(nop) ENV LC_ALL=C.UTF-8 0 B
(nop) ADD jessie.tar.xz in / 121 MB
(nop) MAINTAINER Tianon Gravi <ad 0 B

To see how the docker:apache image was added to a container’s base image:

1
2
3
$ docker history docker:scm
(nop) ADD file:1fd8d7f9f6557cafc7 373.7 MB
(nop) MAINTAINER Lokesh Mandvekar 0 B

Format the output

The formatting option (--format) will pretty-prints history output using a Go template.

Valid placeholders for the Go template are listed below:

1
2
3
4
5
6
7
Placeholder	Description
.ID Image ID
.CreatedSince Elapsed time since the image was created if --human=true, otherwise timestamp of when image was created
.CreatedAt Timestamp of when image was created
.CreatedBy Command that was used to create the image
.Size Image disk size
.Comment Comment for image

When using the --format option, the history command will either output the data exactly as the template declares or, when using the table directive, will include column headers as well.

The following example uses a template without headers and outputs the ID and CreatedSince entries separated by a colon (:) for the busybox image:

1
2
$ docker history --format "{{.ID}}: {{.CreatedSince}}" busybox
: 4 weeks ago

References

[1] docker history | Docker Documentation - https://docs.docker.com/engine/reference/commandline/history/

[2] Empowering App Development for Developers | Docker - https://www.docker.com/