Docker tmpfs mounts
At the beginning of this chapter, we mentioned that Docker allows you to use the host's RAM as a temporary storage location for container data. This type of mount will not persist data but for the right workload, it can be a very useful storage location. tmpfs offers a few unique advantages that are not available in volumes or bind mounts:
- The size can be pre-defined to limit the amount of RAM that is consumed for storage.
- Offers very fast data access.
There are also some limitations to tmpfs mounts:
- They are only available on Linux; Windows is not supported.
- A single tmpfs can only be mounted to one container.
Using a tmpfs mount in a container
A container can be started with a tmpfs mount by adding either --mount
or using the --tmpfs
option. In general, you should use the --mount
option by default since --tmpfs
does not allow for any customizations on the mount. If you use --tmpfs
, you will not be able to set a size...