Get Filesystem Changes That Performed in Docker Container

Get Filesystem Changes That Performed in Docker Container

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.

The 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

Output example:

C /var
C /var/cache
C /var/cache/nginx
A /var/cache/nginx/scgi_temp
...
C /run
A /run/nginx.pid
C /etc
C /etc/nginx
C /etc/nginx/conf.d
C /etc/nginx/conf.d/default.conf

The following changes are tracked:

SymbolDescription
AThe file or directory has been added.
CThe file or directory has been changed.
DThe file or directory has been deleted.

Leave a Comment

Cancel reply

Your email address will not be published.