Docker bind mounts and tmpfs mounts
Answer: When you use a bind mount, a file or directory on the host machine is mounted from the host into a container. A tmpfs mount is temporary and only persisted in the host memory; when the container stops, it is removed. (S1, S2)
Bind mounts
- By contrast, when you use a volume, a new directory is created within Docker's storage directory on the host machine. (S1)
- Bind mounts are useful for sharing source code or build artifacts between a development environment on the Docker host and a container. (S1)
- Bind mounts are also available for builds: you can bind mount source code from the host into the build container to test, lint, or compile a project. (S1)
- If you bind mount into a directory in the container in which files or directories exist, the pre-existing files are obscured by the mount. (S1)
- Bind mounts have write access to files on the host by default. (S1)
- Containers with bind mounts are strongly tied to the host. (S1)
tmpfs mounts
- If you're running Docker on Linux, you have a third option: tmpfs mounts. (S2)
- When the container stops, the tmpfs mount is removed, and files written there won't be persisted. (S2)
- tmpfs mounts are best used for cases when you do not want the data to persist either on the host machine or within the container. (S2)
- Because tmpfs mounts map directly to tmpfs in the Linux kernel, the temporary data may be written to a swap file. (S2)
- Unlike volumes and bind mounts, you can't share tmpfs mounts between containers. (S2)
Claims
- id: C1 claim: A bind mount mounts a host file or directory into a container. source: S1 evidence: "targetThe path where the file or directory is mounted in the container."
- id: C2 claim: Bind mounts have write access to host files by default. source: S1 evidence: "Bind mounts have write access to files on the host by default."
- id: C3 claim: A tmpfs mount is removed when the container stops. source: S2 evidence: "When the container stops, the tmpfs mount is removed"
- id: C4 claim: tmpfs mounts cannot be shared between containers. source: S2 evidence: "Unlike volumes and bind mounts, you can't share tmpfs mounts between containers."
Sources
- [S1] Bind mounts. Docker Docs. https://docs.docker.com/engine/storage/bind-mounts/ . License: Docker docs, Apache-2.0 (github.com/docker/docs; https://github.com/docker/docs/blob/main/LICENSE); Docker name and logo are trademarks of Docker Inc and are not licensed. Accessed 2026-11-04.
- [S2] tmpfs mounts. Docker Docs. https://docs.docker.com/engine/storage/tmpfs/ . License: Docker docs, Apache-2.0 (github.com/docker/docs; https://github.com/docker/docs/blob/main/LICENSE); Docker name and logo are trademarks of Docker Inc and are not licensed. Accessed 2026-11-04.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted).
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Docker Docs, Bind mounts, Docker docs, Apache-2.0 (github.com/docker/docs; https://github.com/docker/docs/blob/main/LICENSE); Docker name and logo are trademarks of Docker Inc and are not licensed; Docker Docs, tmpfs mounts, Docker docs, Apache-2.0 (github.com/docker/docs; https://github.com/docker/docs/blob/main/LICENSE); Docker name and logo are trademarks of Docker Inc and are not licensed.
Cite this
iinventedlight. 2026. "Docker bind mounts and tmpfs mounts." iinventedlight Library, iil:note:hrs3taw8, version of 2026-11-04. https://iinventedlight.com/library/notes/docker-bind-mounts-tmpfs/. License: CC-BY-4.0.
@misc{iil_note_hrs3taw8,
author = {{iinventedlight}},
title = {{Docker bind mounts and tmpfs mounts}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-04},
url = {https://iinventedlight.com/library/notes/docker-bind-mounts-tmpfs/},
note = {Permanent ID iil:note:hrs3taw8. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.
For language models and agents: start at /llms.txt. This page in Markdown: /library/notes/docker-bind-mounts-tmpfs.md.