<p>Docker is running in a VM on MacOS. One of your options is to put the entire VM on a tmpfs. You could use this shell script to create and mount the ramdisk: <a href="https://gist.github.com/koshigoe/822455" rel="nofollow noreferrer">https://gist.github.com/koshigoe/822455</a></p>

<p>Here is a guide for resizing the machine. <a href="https://gist.github.com/stefanfoulis/5bd226b25fa0d4baedc4803fc002829e" rel="nofollow noreferrer">https://gist.github.com/stefanfoulis/5bd226b25fa0d4baedc4803fc002829e</a></p>

<p>The trick is to stop docker first, then you can make changes and move the </p>

<blockquote>
  <p>~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2</p>
</blockquote>

<p>wherever you like and symlink there from this location.</p>

CC BY-SA 3.0
2018-05-01T19:03:02.120Z
2018-05-01T23:00:59.173Z
2018-05-01T23:00:59.173Z
Jiri Klouda
<p>I might be misunderstanding the question.</p>

<p>You tell docker where to put your volume data when you run the container. See <a href="https://docs.docker.com/engine/reference/run/#volume-shared-filesystems" rel="nofollow noreferrer">the docs</a>. It's not something you need to define in a global config. For example:</p>

<pre><code>docker run -v /Volumes/DockerData/nginx_conf:/etc/nginx/conf.d nginx:latest
</code></pre>

<p>The above would run nginx but pull whatever config files you have in nginx_conf.</p>

CC BY-SA 3.0
2018-04-30T17:12:07.053Z
okay may be I am misunderstaing it. Isnt -v is only to mount some local host directory into docker? How I can specify to run docker in ramdisk.. that's my question. In other words how to specify nginx runs in ramdisk. I know how to do it using gui but I would like to do it in cmdline
muhammad haris
CC BY-SA 3.0
2018-04-30T17:19:46.477Z
You are correct. This is only for the container volumes, not the docker binary itself.
Jacob Vanus
CC BY-SA 3.0
2018-04-30T17:09:59.790Z
2018-04-30T17:09:59.790Z
Jacob Vanus
<p>As answered in this questions: <a href="https://devops.stackexchange.com/questions/4012/does-docker-on-macos-support-tmpfs/4020?noredirect=1#comment5811_4020">Does Docker on MacOS support <code>tmpfs</code>?</a> In order to run in memory docker, I need to move docker volumes to ramdisk. In macOS I can do it through docker preferences. However, I would like to write a script that could do it for me everytime I run docker on my machine. Is it possible to specify this setting using cmdline in mac? </p>

<docker><docker-compose><macos>
How to move disk image in the command line?
muhammad haris
# How to move disk image in the command line?

(Asked by: username_0 on 2018-04-30)

As answered in this questions: [Does Docker on MacOS support `tmpfs`?](https://devops.stackexchange.com/questions/4012/does-docker-on-macos-support-tmpfs/4020?noredirect=1#comment5811_4020) In order to run in memory docker, I need to move docker volumes to ramdisk. In macOS I can do it through docker preferences. However, I would like to write a script that could do it for me everytime I run docker on my machine. Is it possible to specify this setting using cmdline in mac?

**Tags:** docker, docker-compose, macos


---

## 2 answers

### Answer by username_1 on 2018-05-01. Score: 2

Docker is running in a VM on MacOS. One of your options is to put the entire VM on a tmpfs. You could use this shell script to create and mount the ramdisk: <https://gist.github.com/koshigoe/822455>

Here is a guide for resizing the machine. <https://gist.github.com/stefanfoulis/5bd226b25fa0d4baedc4803fc002829e>

The trick is to stop docker first, then you can make changes and move the

> ~/Library/Containers/com.docker.docker/Data/com.docker.driver.amd64-linux/Docker.qcow2

wherever you like and symlink there from this location.


---

### Answer by username_2 on 2018-04-30. Score: 0

I might be misunderstanding the question.
You tell docker where to put your volume data when you run the container. See the docs. It's not something you need to define in a global config. For example:
docker run -v /Volumes/DockerData/nginx_conf:/etc/nginx/conf.d nginx:latest

The above would run nginx but pull whatever config files you have in nginx_conf.

> **Comments:**
> **username_0**: okay may be I am misunderstaing it. Isnt -v is only to mount some local host directory into docker? How I can specify to run docker in ramdisk.. that's my question. In other words how to specify nginx runs in ramdisk. I know how to do it using gui but I would like to do it in cmdline  
> **username_2**: You are correct. This is only for the container volumes, not the docker binary itself.  

---

