Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the docker container data stored on the host machine?

In docker, where is the container data, apart from the mounted volume, is stored till the container is running.

So lets say /usr/local is volume mounted, so it would be shared between the host and the container. Where is everything else stored?

like image 630
Nagri Avatar asked Apr 10 '18 10:04

Nagri


People also ask

Where is docker container data stored Linux?

On a linux system, docker stores data pertaining to images, containers, volumes, etc under /var/lib/docker.

Where are docker volumes stored on Windows host?

Docker volumes on Windows are always created in the path of the graph driver, which is where Docker stores all image layers, writeable container layers and volumes. By default the root of the graph driver in Windows is C:\ProgramData\docker , but you can mount a volume to a specific directory when you run a container.

Where are container volumes stored?

Volumes are also stored as part of the host file system, which is managed by Docker. On Linux, volumes are stored in “/var/lib/docker/volume”. Non-Docker processes should not be allowed to modify this part of the file system. One of the best ways to persist data in Docker is Volumes.


1 Answers

You should inspect your docker container

docker inspect [ID_CONTAINER]

and check for the fields MergedDir, LowerDir and UpperDir. Docker uses OverlayFS file system to store the data.

OverlayFS layers two directories on a single Linux host and presents them as a single directory. These directories are called layers and the unification process is referred to a a union mount. OverlayFS refers to the lower directory as lowerdir and the upper directory a upperdir. The unified view is exposed through its own directory called merged. enter image description here

Check the doc here.

like image 176
fingerprints Avatar answered Sep 19 '22 15:09

fingerprints