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.
1 Answer
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.
-
1Thanks for your reply can you tell me about inmemory filesystem. It looks like it does exactly what I require. docs.docker.com/registry/storage-drivers/inmemory However I dont know how to configure it. Apr 30, 2018 at 16:02
-
1What I describe does not require the use of any special storage drivers from docker. MacOS is handling that for you. Just use it as a standard volume. eg:
-v /Volumes/DockerDisk/foo:/etc/foo
Apr 30, 2018 at 16:42 -
okay sweet I have accepted your answer. Can you tell me how I can move the volume without using GUI on mac.. or should I ask it as a new question? Apr 30, 2018 at 16:45
-
Might be better as its own question, just to keep the answers separate. Off hand, I'm not sure what you mean by "move the volume". Apr 30, 2018 at 16:52
-
Here is my new question: devops.stackexchange.com/questions/4023/… Apr 30, 2018 at 16:57