<blockquote>
  <p>If I understand Docker Desktop and Hyper-V correctly, volumes are stored inside a MobyLinuxVM.</p>
</blockquote>

<p>That's right and it seems to be possible to  move the whole VM to another drive as described <a href="https://github.com/docker/for-win/issues/1589#issuecomment-373435228" rel="nofollow noreferrer">here</a>. </p>

<p>Maybe you could solve you problem by using a volume driver as <a href="https://docs.docker.com/storage/volumes/" rel="nofollow noreferrer">described in the official docs</a>. </p>

<p>Another approach is to use a Linux VM with Docker and tell your Docker on Windows installation to use another daemon by setting the <a href="https://docs.docker.com/engine/reference/commandline/cli/" rel="nofollow noreferrer">DOCKER_HOST</a> environment variable. This will give you more control and will allow you to use everything available on Linux (mounting, symbolic links, ...). But of course this will not work if you or your IT department want to use Windows containers some day. </p>

CC BY-SA 4.0
2019-10-20T16:55:14.327Z
2019-10-20T17:42:32.530Z
2019-10-20T17:42:32.530Z
lukket
<p>I'm really familiar with Docker on Linux but my company's IT department uses Windows. They're interested in converting VM-based services over to Docker so I'm trying to get them set up with a good Windows-based Docker infrastructure. </p>

<p>I've started with a couple containers managed by <code>docker-compose</code>. I would like to use named containers rather than hardcoding paths. For example:</p>

<pre><code>volumes:
  portainer_data:

services:
  portainer:
    image: portainer/portainer:latest
    volumes:
      - portainer_data:/data
</code></pre>

<p>They created a 900GB <code>E:</code> drive to hold persistent data. <strong>How can I get all the named volumes for all containers to be stored in <code>E:\Volumes</code>?</strong></p>

<ul>
<li>I figure it would make it super easy for them to configure backup. Instead of having to script a bunch of steps using <code>docker cp</code> I could just tell them, "Back up the <code>E:</code> drive". Easy.</li>
<li>If I understand Docker Desktop and Hyper-V correctly, volumes are stored inside a MobyLinuxVM. The VM is on the <code>C:</code> drive and only has 48GB to play with.</li>
</ul>

<p>(Please let me know if there's a better way to tackle this in general. I'm open to frame challenges. Down the road I'd like to add Kubernetes or Docker Swarm to the mix, but one step at a time.)</p>

<p><strong>OS:</strong> Windows Server 2019 Datacenter</p>

<docker><docker-compose><windows><volume>
Store named volumes on another drive
John Kugelman
# Store named volumes on another drive

(Asked by: username_0 on 2019-06-25)

I'm really familiar with Docker on Linux but my company's IT department uses Windows. They're interested in converting VM-based services over to Docker so I'm trying to get them set up with a good Windows-based Docker infrastructure. 
I've started with a couple containers managed by docker-compose. I would like to use named containers rather than hardcoding paths. For example:
volumes:
  portainer_data:

services:
  portainer:
    image: portainer/portainer:latest
    volumes:
      - portainer_data:/data

They created a 900GB E: drive to hold persistent data. How can I get all the named volumes for all containers to be stored in E:\Volumes?

I figure it would make it super easy for them to configure backup. Instead of having to script a bunch of steps using docker cp I could just tell them, "Back up the E: drive". Easy.
If I understand Docker Desktop and Hyper-V correctly, volumes are stored inside a MobyLinuxVM. The VM is on the C: drive and only has 48GB to play with.

(Please let me know if there's a better way to tackle this in general. I'm open to frame challenges. Down the road I'd like to add Kubernetes or Docker Swarm to the mix, but one step at a time.)
OS: Windows Server 2019 Datacenter

**Tags:** docker, docker-compose, windows, volume


---

## 1 answers

### Answer by username_1 on 2019-10-20. Score: 1

> If I understand Docker Desktop and Hyper-V correctly, volumes are stored inside a MobyLinuxVM.

That's right and it seems to be possible to move the whole VM to another drive as described [here](https://github.com/docker/for-win/issues/1589#issuecomment-373435228).

Maybe you could solve you problem by using a volume driver as [described in the official docs](https://docs.docker.com/storage/volumes/).

Another approach is to use a Linux VM with Docker and tell your Docker on Windows installation to use another daemon by setting the [DOCKER\_HOST](https://docs.docker.com/engine/reference/commandline/cli/) environment variable. This will give you more control and will allow you to use everything available on Linux (mounting, symbolic links, ...). But of course this will not work if you or your IT department want to use Windows containers some day.


---

