Answers: <p>According to <a href="https://docs.docker.com/storage/tmpfs/#limitations-of-tmpfs-mounts" rel="noreferrer">the docs</a> tmpfs is linux only. </p>
  
  <p><strong>RAM disk</strong></p>
  
  <p>If you want "RAM only storage", you can literally use a <a href="https://www.tekrevue.com/tip/how-to-create-a-4gbs-ram-disk-in-mac-os-x/" rel="noreferrer">RAM disk</a>. ie: </p>
  
  <pre><code>diskutil erasevolume HFS+ 'DockerDisk' `hdiutil attach -nomount ram://2097152 `
  </code></pre>
  
  <p>Then you can point volumes at <code>/Volumes/DockerDisk</code>. Drop and recreate at will. </p>
  
  <p>Docker will still store its VM and images on disk. See: Docker > Preferences > Disk.</p>
  
Answers: CC BY-SA 3.0
Answers: 2018-04-30T16:02:58.947Z
Answers: Thanks for your reply can you tell me about inmemory filesystem. It looks like it does exactly what I require. https://docs.docker.com/registry/storage-drivers/inmemory/ However I dont know how to configure it.
Answers: muhammad haris
Answers: CC BY-SA 3.0
Answers: 2018-04-30T16:42:48.723Z
Answers: 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`
Answers: Jacob Vanus
Answers: CC BY-SA 3.0
Answers: 2018-04-30T16:45:27.380Z
Answers: 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?
Answers: muhammad haris
Answers: CC BY-SA 3.0
Answers: 2018-04-30T16:52:02.443Z
Answers: 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".
Answers: Jacob Vanus
Answers: CC BY-SA 3.0
Answers: 2018-04-30T16:57:44.690Z
Answers: Here is my new question: https://devops.stackexchange.com/questions/4023/macos-how-to-move-disk-image-in-command-line
Answers: muhammad haris
Answers: CC BY-SA 4.0
Answers: 2020-10-12T14:27:11.680Z
Answers: The "In-memory storage driver" referenced in the first comment is for registry specifically. It is not docker storage backend, but a docker registry storage backend, so irrelevant to the described problem.
Answers: alexykot
Answers: CC BY-SA 3.0
Answers: 2018-04-30T14:47:14.813Z
Answers: 2018-04-30T14:47:14.813Z
Answers: Jacob Vanus
Body: <p>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.</p>
  
Comments: CC BY-SA 3.0
Comments: 2018-04-30T04:45:12.310Z
Comments: You might find this useful if you try to make Docker run read only. https://devops.stackexchange.com/questions/3872/how-do-i-make-read-only-mount-in-docker-container-writable
Comments: Jiri Klouda
Tags: <docker><containers><docker-machine>
Title: Does Docker on MacOS support tmpfs?
UserDisplayName: muhammad haris
ThreadText: # Does Docker on MacOS support tmpfs?
  
  (Asked by: username_0 on 2018-04-30)
  
  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.
  
  **Tags:** docker, containers, docker-machine
  
  > **Comments:**
  > **username_1**: You might find this useful if you try to make Docker run read only. https://devops.stackexchange.com/questions/3872/how-do-i-make-read-only-mount-in-docker-container-writable  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-04-30. Score: 5 | Accepted answer
  
  According to [the docs](https://docs.docker.com/storage/tmpfs/#limitations-of-tmpfs-mounts) tmpfs is linux only.
  
  **RAM disk**
  
  If you want "RAM only storage", you can literally use a [RAM disk](https://www.tekrevue.com/tip/how-to-create-a-4gbs-ram-disk-in-mac-os-x/). 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.
  
  > **Comments:**
  > **username_0**: Thanks for your reply can you tell me about inmemory filesystem. It looks like it does exactly what I require. https://docs.docker.com/registry/storage-drivers/inmemory/ However I dont know how to configure it.  
  > **username_2**: 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`  
  > **username_0**: 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?  
  > **username_2**: 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".  
  > **username_0**: Here is my new question: https://devops.stackexchange.com/questions/4023/macos-how-to-move-disk-image-in-command-line  
  > **username_3**: The "In-memory storage driver" referenced in the first comment is for registry specifically. It is not docker storage backend, but a docker registry storage backend, so irrelevant to the described problem.  
  
  ---
  
  