LinuxCommandLibrary

docker-container-diff

Show filesystem changes inside a container

TLDR

Inspect the changes to a container since it was created

$ docker [[diff|container diff]] [container]
copy

Display help
$ docker [[diff|container diff]] --help
copy

SYNOPSIS

docker diff CONTAINER
Alias: docker container diff CONTAINER

DESCRIPTION

The docker diff (or docker container diff) command analyzes and displays the changes made to a container's filesystem since it was started. It lists files and directories that have been Added, Changed, or Deleted relative to the container's initial state from its image, including any writes, mounts, or modifications by processes inside the container.

This tool is invaluable for debugging container behavior, identifying unexpected file alterations by applications, or understanding the impact of volume mounts and bind mounts (which appear as changes). The output mimics the style of traditional Unix diff tools but uses single-letter prefixes followed by paths.

It operates on both running and stopped containers without requiring a restart. Changes reflect the effective filesystem view, including overlaid layers from Docker's storage driver. Note that this command focuses solely on filesystem deltas and does not report metadata changes, network state, or process information.

CAVEATS

Shows only filesystem changes since container start; ignores image layer history, container metadata, or runtime state. Paths are relative to container root. Large containers may produce verbose output.

OUTPUT FORMAT

A /path/to/added/file
C /path/to/changed/file
D /path/to/deleted/file

EXAMPLE USAGE

docker diff my-container

Produces a list like:
A /etc/hosts
C /tmp/log.txt
D /var/old.log

HISTORY

Introduced in Docker 1.5.0 (February 2014) as part of early CLI enhancements for container inspection. Evolved with Docker's storage drivers; remains a core, stable command in modern Docker versions.

SEE ALSO

docker inspect(1), docker ps(1), diff(1)

Copied to clipboard