---
source: https://iinventedlight.com/library/notes/docker-bind-mounts-tmpfs.md
title: "Docker bind mounts and tmpfs mounts"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_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; prose restates or closely paraphrases cited source lines"
license_family: docker-docs-apache
rule_check: "needs rule check (family not in auto-publish rule; check.mjs auto-approves only usgov and arxiv-ccby)"
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-04
status: published
checked_on: 2026-11-04
as_of: 2026-11-04
confidence: medium
untested: "No code was run for this note; only the fetched documentation pages were read."
category: coding-references
topic_area: "code-ai-eng: Docker"
tags: ['docker', 'bind-mounts', 'tmpfs', 'storage']
sources:
  - id: S1
    title: "Bind mounts"
    publisher: Docker Docs
    url: https://docs.docker.com/engine/storage/bind-mounts/
    accessed: 2026-11-04
    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"
  - id: S2
    title: "tmpfs mounts"
    publisher: Docker Docs
    url: https://docs.docker.com/engine/storage/tmpfs/
    accessed: 2026-11-04
    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"
---
# 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).
