What's the correct way to mount a volume on Docker for Windows?

by Mike Christensen   Last Updated September 14, 2018 16:01 PM

I've looked at a few similar issues and bugs online, but so far none of them have helped. What's the correct way to mount a volume in a container running on Docker for Windows? I'm running Docker 18.06.1-ce on Windows 10 (Latest). First, I create a local directory called C:\DeleteMe, and did a docker pull hello-world for testing. I would like to mount the contents of DeleteMe in a directory on the container called Data.

I first tried:

docker run -it -v C:\DeleteMe:/Data hello-world cmd

But I got back:

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid volume specification: 'C:\DeleteMe:/Data'. See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

I also tried:

-v C:\DeleteMe:/Data hello-world cmd
-v C:\DeleteMe:/c/Data hello-world cmd
-v C:\DeleteMe:/c:/Data hello-world cmd
-v C:\DeleteMe:/c:\Data hello-world cmd

And about every other variety I could think of with various front slashes and back slashes for each. All have the same error message.

I've also tried the --mount syntax:

docker run -it --mount source=C:\DeleteMe,target=/Data hello-world cmd

And got a similar error:

C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid mount config for type "volume": invalid mount path: '/Data'. See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.

What's the secret?



Related Questions


docker toolbox (quick start terminal)

Updated February 06, 2018 22:01 PM


How to combine multiple applications with Docker?

Updated August 09, 2017 11:01 AM


How can I run docker on a Windows VM on Linux

Updated January 31, 2018 22:01 PM