Skip to content

Volumes vs bind mounts

Select an icon to see what it is.

Step 3 of 6

runc bind-mounts it into the container

runc does a bind mount of /var/lib/docker/volumes/pgdata/_data onto /var/lib/postgresql/data inside the container's mount namespace. The container sees the host directory at that path. Files written there are written to the host directory.

mount (in the container's namespace)

source /var/lib/docker/volumes/pgdata/_data
target /var/lib/postgresql/data
flags MS_BIND | MS_REC (rbind), rprivate