Docker images are used to create containers. During creation, the Docker container inherits the filesystem of the image. Files and directories inside a container can be changed. Filesystem of the container can diverge from the initial filesystem of the image. The ability to see differences in the filesystem can help when troubleshooting issues and find missing data. This tutorial demonstrates how to get a filesystem changes that performed in a Docker container.
docker diff command, or
docker container command with
diff argument, can be used to get changes to files or directories of the container's filesystem since it was created. The command accepts container ID or name. For example, to inspect changes to an
nginx container, you can use:
docker diff nginx
docker container diff nginx
The following changes are tracked:
|The file or directory has been added.
|The file or directory has been changed.
|The file or directory has been deleted.