HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerMinor

Does Docker on MacOS support tmpfs?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
macostmpfsdockerdoessupport

Problem

I am new to Docker and I want to run Docker with ram only storage. In other words, I do not want Docker to save anything on persistent storage. I found out that on Linux Docker supports tmpfs. Is there any such support for MacOS? I have tried setting --tmpfs flag and docker run commands run fine on mac with that flag.

Solution

According to the docs tmpfs is linux only.

RAM disk

If you want "RAM only storage", you can literally use a RAM disk. ie:

diskutil erasevolume HFS+ 'DockerDisk' `hdiutil attach -nomount ram://2097152 `


Then you can point volumes at /Volumes/DockerDisk. Drop and recreate at will.

Docker will still store its VM and images on disk. See: Docker > Preferences > Disk.

Code Snippets

diskutil erasevolume HFS+ 'DockerDisk' `hdiutil attach -nomount ram://2097152 `

Context

StackExchange DevOps Q#4012, answer score: 5

Revisions (0)

No revisions yet.