5

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

1 Answer 1

4

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.

6
  • 1
    Thanks 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
  • 1
    What 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.