Quiz Entry - updated: 2026.12.01
How does a bind mount behave, and how does it differ from a volume?
A bind mount maps an existing host folder into the container: both sides see and change the same files live, and Docker does not manage it.
echo "hello world" > ~/dockerlab/bindmount.txt
docker container run -dit --name bindmount \
--mount type=bind,source=/home/labadmin/dockerlab,target=/app nginx:latest
docker container exec bindmount ls -la /app # bindmount.txt is there
docker container exec bindmount rm /app/bindmount.txt # ...and now gone on the host too
The container's /app is the host's ~/dockerlab. Deleting the file inside the container deletes it on the host. A bind mount also hides whatever the image had at the target path, which is useful to override a default configuration file with your own.
| Volume | Bind mount | |
|---|---|---|
| Location | Docker's area /var/lib/docker/volumes/ |
Any host path you name |
| Managed by Docker | Yes: docker volume ls/inspect/rm, shows which containers use it |
No: Docker cannot tell which containers share it |
| Access from host | Root only | Normal file paths, normal users |
| Typical use | Production data | Development (live code), injecting config |
Security note: a bind mount gives the container direct write access to host files. Mounting a sensitive path (/, /etc, the Docker socket) can hand over the whole host.
Go deeper:
Docker Docs: Bind mounts — syntax, read-only binds and the security considerations.