Docker Diff Command
# Docker diff Command
[Docker Command Manual](#)
* * *
The `docker diff` command is used to display changes in a Docker container's filesystem. It shows all modifications that have occurred in the filesystem since the container was created, including added, deleted, and modified files or directories.
The `docker diff` command is very useful for debugging and understanding changes to a container's filesystem.
### Syntax
docker diff CONTAINER
* **`CONTAINER`**: The name or ID of the container.
The output of the `docker diff` command contains three types of changes:
* **`A`**: Indicates added files or directories.
* **`D`**: Indicates deleted files or directories.
* **`C`**: Indicates modified files or directories.
**Viewing a container's filesystem changes**
docker diff my_container
Displays the filesystem changes for the container named my_container.
### Examples
Start a container and modify the filesystem:
docker run -d --name my_container ubuntu bash -c "echo 'Hello, Docker!' > /hello.txt && sleep 3600"
View the container's filesystem changes:
docker diff my_container
Example output:
A /hello.txt
This output indicates that the file /hello.txt was added to the container's filesystem.
Delete a file from the container:
docker exec my_container rm /hello.txt
View the container's filesystem changes again:
docker diff my_container
Example output:
D /hello.txt
This output indicates that the file /hello.txt was deleted from the container's filesystem.
### Notes
* The `docker diff` command only shows changes to the container's filesystem; it does not display other state information within the container (such as running processes).
* The output information may change continuously as the filesystem within the container changes, so it should be viewed promptly when needed.
The `docker diff` command is a powerful tool for displaying changes to a Docker container's filesystem. By using this command, users can easily view and understand the filesystem changes made to a container since its creation, which helps with debugging, auditing, and analyzing container behavior.
* * Docker Command Manual](#)
YouTip