top of page
Writer's picturevP

tmpfs mounts in Docker

Volumes and bind mounts let you share files between the host machine and container so that you can persist data even after the container is stopped.


If you’re running Docker on Linux, you have a third option: tmpfs mounts. When you create a container with a tmpfs mount, the container can create files outside the container’s writable layer.

Courtesy - Docs.docker.com

As opposed to volumes and bind mounts, a tmpfs mount is temporary, and only persisted in the host memory. When the container stops, the tmpfs mount is removed, and files written there won’t be persisted. This is useful to temporarily store sensitive files that you don’t want to persist in either the host or the container writable layer.


Limitations of tmpfs mounts -

  • Unlike volumes and bind mounts, you can’t share tmpfs mounts between containers.

  • This functionality is only available if you’re running Docker on Linux.

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. This may be for security reasons or to protect the performance of the container when your application needs to write a large volume of non-persistent state data.


For more information on using a tmpfs mount in a container, please refer to this page.


Thank you for reading!


*** Explore | Share | Grow ***

5 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page