<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>

CC BY-SA 3.0
2018-04-30T16:02:58.947Z
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.
muhammad haris
CC BY-SA 3.0
2018-04-30T16:42:48.723Z
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`
Jacob Vanus
CC BY-SA 3.0
2018-04-30T16:45:27.380Z
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?
muhammad haris
CC BY-SA 3.0
2018-04-30T16:52:02.443Z
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".
Jacob Vanus
CC BY-SA 3.0
2018-04-30T16:57:44.690Z
Here is my new question: https://devops.stackexchange.com/questions/4023/macos-how-to-move-disk-image-in-command-line
muhammad haris
CC BY-SA 4.0
2020-10-12T14:27:11.680Z
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.
alexykot
CC BY-SA 3.0
2018-04-30T14:47:14.813Z
2018-04-30T14:47:14.813Z
Jacob Vanus
<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>

CC BY-SA 3.0
2018-04-30T04:45:12.310Z
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
Jiri Klouda
<docker><containers><docker-machine>
Does Docker on MacOS support tmpfs?
muhammad haris
# 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 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.

> **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.  

---

