Forrest logo
back to the docker tool

docker:tldr:467a5

docker: Show the history of a local Docker image.
$ docker image history ${image}
try on your machine

The "docker image history" command is used to display the history of changes made in a Docker image. The command takes the following syntax:

docker image history ${image}

where ${image} is the name or ID of the Docker image you want to inspect.

When you execute this command, it will present a list of key events in a layered format. Each event represents a change that was made to the image at a specific point in time during its creation. By default, the events are ordered from the most recent to the initial event (base image). Here are some common events displayed:

  1. Base Image: The initial event represents the base image from which the current image was built. It denotes the starting point for the image's history.

  2. Added or Changed Files: Each event lists the files that were added or modified in that particular layer. It helps in understanding the changes made during the image's build process.

  3. Execution Steps: The command specifies the commands executed in the specific layer using the RUN instruction. It shows the exact command used during the build process.

  4. Environment Variables: Docker tracks the environment variables set within each layer and displayed them during the history. Details like variable names and values can be viewed.

  5. Metadata or Labels: Any labels or metadata added using the LABEL instruction will be displayed in the event history.

This command is helpful in understanding how an image was created and the changes made during its construction. It can be used to troubleshoot issues, identify the impact of specific commands, or trace any vulnerabilities introduced.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the docker tool