Storage for Docker Containers
This was written using Alpine 3.18 and Docker 23.0.6. All the snippets below were correct at the time of writing ;-).
Where?
Where is the filesystem present in the container stored?
$ docker inspect 1097c009fe6b --format '{{.GraphDriver.Data.MergedDir }}'
/var/lib/docker/overlay2/5caf5b1ac4b7783d61cfee47c1b3b959d37459c0e6855da1a36754cdf4b207dc/merged
1097c009fe6b
in the above example is the shortened hash of the running
container, it may be substituted with the name of the container or the full
hash. If the container is not running the UpperDir
will contain the
differences from the base image:
$ docker inspect e053591239bd --format '{{.GraphDriver.Data.UpperDir }}'
/var/lib/docker/overlay2/b30f69a1e579511cada4f1156d8d865dc1d69c467b17db377cc5de563f4a02d8/diff
These directories and the files within will have permissions for the container users... however those have been set-up.
Binds
If the container was started with any binding/volume arguments (-v
) then
dumping those might be useful also:
docker inspect e053591239bd --format '{{.HostConfig.Binds }}'