Basic volume mount fails with windows docker client against boot2docker #12751

Closed
skaegi opened this Issue Apr 24, 2015 · 22 comments

Comments

Projects
None yet
@skaegi

skaegi commented Apr 24, 2015

I'm just trying to do the most basic volume mount. Something like....

$ docker run -it -v /myvol debian:jessie /bin/bash
FATA[0000] Error response from daemon: cannot bind mount volume: C volume paths must be absolute.

Using docker 1.6
Windows Client / Boot2Docker Host
Git Bash with eval ${boot2docker shellinit}

Using a host directory I get...

$ docker run -it -v /myvol:/myvol debian:jessie /bin/bash
invalid value "C:\\Program Files (x86)\\Git\\myvol;C:\\Program Files (x86)\\Git\\myvol" for flag -v: \Program Files (x86)\Git\myvol;C:\Program Files (x86)\Git\myvol is not an absolute path
See 'c:\Program Files\Boot2Docker for Windows\docker.exe run --help'.

I expected everything to run relative to the host. e.g. I expected the same behavior as if I was running these commands with boot2docker ssh. Am I missing something here?

@carloscasalar

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Apr 25, 2015

Member

/ping @ahmetalpbalkan (haven't tested this myself yet)

Member

thaJeztah commented Apr 25, 2015

/ping @ahmetalpbalkan (haven't tested this myself yet)

@ahmetb

This comment has been minimized.

Show comment
Hide comment
@ahmetb

ahmetb Apr 25, 2015

Contributor

@skaegi @SirRagnar This is duplicate of #12590. It's happening due to msys, it converts unix paths to windows paths before passing them to docker.exe. In this case, that's not a docker bug. (it's not a msys bug either, it's by design.)

See my comments in #12590 to run it correctly, or use cmd.exe or powershell to not to have this problem.

Contributor

ahmetb commented Apr 25, 2015

@skaegi @SirRagnar This is duplicate of #12590. It's happening due to msys, it converts unix paths to windows paths before passing them to docker.exe. In this case, that's not a docker bug. (it's not a msys bug either, it's by design.)

See my comments in #12590 to run it correctly, or use cmd.exe or powershell to not to have this problem.

@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Apr 25, 2015

Member

@ahmetalpbalkan do you think we should add something to the docs explaining this? I can imagine more people will run into this.

I'm going to close this issue, because of the reasons mentioned above #12751 (comment)

Thanks for reporting @skaegi, it's appreciated

Member

thaJeztah commented Apr 25, 2015

@ahmetalpbalkan do you think we should add something to the docs explaining this? I can imagine more people will run into this.

I'm going to close this issue, because of the reasons mentioned above #12751 (comment)

Thanks for reporting @skaegi, it's appreciated

@thaJeztah thaJeztah closed this Apr 25, 2015

@skaegi

This comment has been minimized.

Show comment
Hide comment
@skaegi

skaegi Apr 27, 2015

I tried the path workarounds with limited luck but indeed this is MSYS path conversion in action -- a few more details here

Double slash works if desperate -- e.g. these work

docker run -it -v //myvol debian:jessie //bin/bash
docker run -it -v //myvol://myvol debian:jessie //bin/bash

but for now probably best to use either powershell or boot2docker ssh

skaegi commented Apr 27, 2015

I tried the path workarounds with limited luck but indeed this is MSYS path conversion in action -- a few more details here

Double slash works if desperate -- e.g. these work

docker run -it -v //myvol debian:jessie //bin/bash
docker run -it -v //myvol://myvol debian:jessie //bin/bash

but for now probably best to use either powershell or boot2docker ssh

@thaJeztah thaJeztah referenced this issue in boot2docker/boot2docker May 11, 2015

Closed

docker run won't work on windows #870

@phazei

This comment has been minimized.

Show comment
Hide comment
@phazei

phazei Jun 4, 2015

The double slash at the beginning works in most cases. But there's one in particular that won't work

docker exec -it web rsync -rvul --exclude='/vendor' //var/www/files_remote/ //var/www/files

Problem bit is --exclude='/vendor' if I switch it to --exclude='//vendor' rsync doesn't match it properly so the vendor directory is included. If I change it to --exclude='vendor' it excludes in sub dirs as well.

I've tried playing with the posix path conversion rules that @skaegi linked to, but couldn't find a combo that would work. Any suggestions?

phazei commented Jun 4, 2015

The double slash at the beginning works in most cases. But there's one in particular that won't work

docker exec -it web rsync -rvul --exclude='/vendor' //var/www/files_remote/ //var/www/files

Problem bit is --exclude='/vendor' if I switch it to --exclude='//vendor' rsync doesn't match it properly so the vendor directory is included. If I change it to --exclude='vendor' it excludes in sub dirs as well.

I've tried playing with the posix path conversion rules that @skaegi linked to, but couldn't find a combo that would work. Any suggestions?

@ahmetb

This comment has been minimized.

Show comment
Hide comment
@ahmetb

ahmetb Jun 4, 2015

Contributor

@phazei hmm actually if the argument starts with ', it doesn't do path conversion AFAIK as documented here. So maybe '--exclude=/vendor' would just work?

Contributor

ahmetb commented Jun 4, 2015

@phazei hmm actually if the argument starts with ', it doesn't do path conversion AFAIK as documented here. So maybe '--exclude=/vendor' would just work?

mlarcher added a commit to mlarcher/docker that referenced this issue Jun 28, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, the is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

mlarcher added a commit to mlarcher/docker that referenced this issue Jun 28, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, the is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

Signed-off-by: Matthieu Larcher <github@ringabell.org>

mlarcher added a commit to mlarcher/docker that referenced this issue Jun 29, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, there is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

Signed-off-by: Matthieu Larcher <github@ringabell.org>

mlarcher added a commit to mlarcher/docker that referenced this issue Jun 30, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, there is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

Signed-off-by: Matthieu Larcher <github@ringabell.org>

mlarcher added a commit to mlarcher/docker that referenced this issue Jul 3, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, there is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

Signed-off-by: Matthieu Larcher <github@ringabell.org>

moxiegirl pushed a commit to moxiegirl/docker that referenced this issue Jul 5, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, there is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

Signed-off-by: Matthieu Larcher <github@ringabell.org>
(cherry picked from commit 33be2c5)

sallyom added a commit to sallyom/docker that referenced this issue Jul 8, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, there is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

Signed-off-by: Matthieu Larcher <github@ringabell.org>

sallyom added a commit to sallyom/docker that referenced this issue Jul 8, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, there is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

Signed-off-by: Matthieu Larcher <github@ringabell.org>

calavera added a commit to calavera/docker that referenced this issue Jul 25, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, there is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

Signed-off-by: Matthieu Larcher <github@ringabell.org>

tiborvass added a commit to tiborvass/docker that referenced this issue Jul 27, 2015

Add workaround in docs for git bash usage issue
When using boot2docker through git bash, there is a nasty issue when trying to share a folder, due to how git bash parses the URIs. The issue is explained in [issue #12751](moby#12751) but needs more visibility in the docs.

Signed-off-by: Matthieu Larcher <github@ringabell.org>

@x97mdr x97mdr referenced this issue in testcontainers/testcontainers-java Mar 1, 2016

Closed

Failing unit tests on Windows: Invalid Bind Mount Spec #84

@ktmswzw

This comment has been minimized.

Show comment
Hide comment
@ktmswzw

ktmswzw Mar 3, 2016

docker run -d --name redis-server -p 6379:6379 -v /h/redis:/var/lib/redis anapsix/redis

/h/redis = H://redis

ktmswzw commented Mar 3, 2016

docker run -d --name redis-server -p 6379:6379 -v /h/redis:/var/lib/redis anapsix/redis

/h/redis = H://redis

@Avinash-Setty

This comment has been minimized.

Show comment
Hide comment
@Avinash-Setty

Avinash-Setty Mar 16, 2016

Recently I tried mounting using Docker Run command in Windows, still it doesn't work. Can anyone help me here?

avina@avinash-laptop MINGW64 ~
$ ll /c/development/phase2/Experiments/SimpleApp/src/SimpleApp
total 872
-rw-r--r-- 1 avina 197611    412 Mar 15 17:44 appsettings.json
-rw-r--r-- 1 avina 197611    207 Mar 15 17:43 bower.json
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Controllers/
-rw-r--r-- 1 avina 197611   1249 Mar 15 17:43 gulpfile.js
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Migrations/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Models/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:43 node_modules/
-rw-r--r-- 1 avina 197611    213 Mar 15 17:43 package.json
-rw-r--r-- 1 avina 197611   1809 Mar 15 17:44 project.json
-rw-r--r-- 1 avina 197611 840603 Mar 15 17:50 project.lock.json
-rw-r--r-- 1 avina 197611   7006 Mar 15 17:43 Project_Readme.html
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Properties/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Services/
-rw-r--r-- 1 avina 197611   1332 Mar 15 17:43 SimpleApp.xproj
-rw-r--r-- 1 avina 197611    241 Mar 15 18:05 SimpleApp.xproj.user
-rw-r--r-- 1 avina 197611   3928 Mar 15 17:44 Startup.cs
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 ViewModels/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Views/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:43 wwwroot/

avina@avinash-laptop MINGW64 ~
$ docker run -v /c/development/phase2/Experiments/SimpleApp/src/SimpleApp:/SimpleApp -p 5000:5000 -it microsoft/aspnet
root@112446af63af:/# cd SimpleApp/
root@112446af63af:/SimpleApp# ls -al
total 4
drwxr-xr-x  2 root root   40 Mar 16 13:36 .
drwxr-xr-x 60 root root 4096 Mar 16 13:36 ..
root@112446af63af:/SimpleApp# exit

Recently I tried mounting using Docker Run command in Windows, still it doesn't work. Can anyone help me here?

avina@avinash-laptop MINGW64 ~
$ ll /c/development/phase2/Experiments/SimpleApp/src/SimpleApp
total 872
-rw-r--r-- 1 avina 197611    412 Mar 15 17:44 appsettings.json
-rw-r--r-- 1 avina 197611    207 Mar 15 17:43 bower.json
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Controllers/
-rw-r--r-- 1 avina 197611   1249 Mar 15 17:43 gulpfile.js
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Migrations/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Models/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:43 node_modules/
-rw-r--r-- 1 avina 197611    213 Mar 15 17:43 package.json
-rw-r--r-- 1 avina 197611   1809 Mar 15 17:44 project.json
-rw-r--r-- 1 avina 197611 840603 Mar 15 17:50 project.lock.json
-rw-r--r-- 1 avina 197611   7006 Mar 15 17:43 Project_Readme.html
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Properties/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Services/
-rw-r--r-- 1 avina 197611   1332 Mar 15 17:43 SimpleApp.xproj
-rw-r--r-- 1 avina 197611    241 Mar 15 18:05 SimpleApp.xproj.user
-rw-r--r-- 1 avina 197611   3928 Mar 15 17:44 Startup.cs
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 ViewModels/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:44 Views/
drwxr-xr-x 1 avina 197611      0 Mar 15 17:43 wwwroot/

avina@avinash-laptop MINGW64 ~
$ docker run -v /c/development/phase2/Experiments/SimpleApp/src/SimpleApp:/SimpleApp -p 5000:5000 -it microsoft/aspnet
root@112446af63af:/# cd SimpleApp/
root@112446af63af:/SimpleApp# ls -al
total 4
drwxr-xr-x  2 root root   40 Mar 16 13:36 .
drwxr-xr-x 60 root root 4096 Mar 16 13:36 ..
root@112446af63af:/SimpleApp# exit
@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Mar 16, 2016

Member

By default, only the "c:\users" directory is shared with the VirtualBox VM, so anything outside of that can't be used as a volume, unless you configured VirtualBox to share other directories

On 16 Mar 2016, at 13:58, Avinash-Setty notifications@github.com wrote:

Recently I tried mounting using Docker Run command in Windows, still it doesn't work. Can anyone help me here?

avina@avinash-laptop MINGW64 ~
$ ll /c/development/phase2/Experiments/SimpleApp/src/SimpleApp
total 872
-rw-r--r-- 1 avina 197611 412 Mar 15 17:44 appsettings.json
-rw-r--r-- 1 avina 197611 207 Mar 15 17:43 bower.json
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Controllers/
-rw-r--r-- 1 avina 197611 1249 Mar 15 17:43 gulpfile.js
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Migrations/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Models/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:43 node_modules/
-rw-r--r-- 1 avina 197611 213 Mar 15 17:43 package.json
-rw-r--r-- 1 avina 197611 1809 Mar 15 17:44 project.json
-rw-r--r-- 1 avina 197611 840603 Mar 15 17:50 project.lock.json
-rw-r--r-- 1 avina 197611 7006 Mar 15 17:43 Project_Readme.html
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Properties/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Services/
-rw-r--r-- 1 avina 197611 1332 Mar 15 17:43 SimpleApp.xproj
-rw-r--r-- 1 avina 197611 241 Mar 15 18:05 SimpleApp.xproj.user
-rw-r--r-- 1 avina 197611 3928 Mar 15 17:44 Startup.cs
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 ViewModels/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Views/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:43 wwwroot/

avina@avinash-laptop MINGW64 ~
$ docker run -v /c/development/phase2/Experiments/SimpleApp/src/SimpleApp:/SimpleApp -p 5000:5000 -it microsoft/aspnet
root@112446af63af:/# cd SimpleApp/
root@112446af63af:/SimpleApp# ls -al
total 4
drwxr-xr-x 2 root root 40 Mar 16 13:36 .
drwxr-xr-x 60 root root 4096 Mar 16 13:36 ..
root@112446af63af:/SimpleApp# exit

You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub

Member

thaJeztah commented Mar 16, 2016

By default, only the "c:\users" directory is shared with the VirtualBox VM, so anything outside of that can't be used as a volume, unless you configured VirtualBox to share other directories

On 16 Mar 2016, at 13:58, Avinash-Setty notifications@github.com wrote:

Recently I tried mounting using Docker Run command in Windows, still it doesn't work. Can anyone help me here?

avina@avinash-laptop MINGW64 ~
$ ll /c/development/phase2/Experiments/SimpleApp/src/SimpleApp
total 872
-rw-r--r-- 1 avina 197611 412 Mar 15 17:44 appsettings.json
-rw-r--r-- 1 avina 197611 207 Mar 15 17:43 bower.json
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Controllers/
-rw-r--r-- 1 avina 197611 1249 Mar 15 17:43 gulpfile.js
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Migrations/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Models/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:43 node_modules/
-rw-r--r-- 1 avina 197611 213 Mar 15 17:43 package.json
-rw-r--r-- 1 avina 197611 1809 Mar 15 17:44 project.json
-rw-r--r-- 1 avina 197611 840603 Mar 15 17:50 project.lock.json
-rw-r--r-- 1 avina 197611 7006 Mar 15 17:43 Project_Readme.html
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Properties/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Services/
-rw-r--r-- 1 avina 197611 1332 Mar 15 17:43 SimpleApp.xproj
-rw-r--r-- 1 avina 197611 241 Mar 15 18:05 SimpleApp.xproj.user
-rw-r--r-- 1 avina 197611 3928 Mar 15 17:44 Startup.cs
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 ViewModels/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:44 Views/
drwxr-xr-x 1 avina 197611 0 Mar 15 17:43 wwwroot/

avina@avinash-laptop MINGW64 ~
$ docker run -v /c/development/phase2/Experiments/SimpleApp/src/SimpleApp:/SimpleApp -p 5000:5000 -it microsoft/aspnet
root@112446af63af:/# cd SimpleApp/
root@112446af63af:/SimpleApp# ls -al
total 4
drwxr-xr-x 2 root root 40 Mar 16 13:36 .
drwxr-xr-x 60 root root 4096 Mar 16 13:36 ..
root@112446af63af:/SimpleApp# exit

You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub

@mathiasconradt

This comment has been minimized.

Show comment
Hide comment
@mathiasconradt

mathiasconradt Mar 17, 2016

I am having the problem on Windows 2016 Server TP4, without using boot2docker, since containers are supported there natively.
I try to mount a folder beneath C:\Users\myuser.. as data volume, like this:

docker run --name iisdemo2 -it -p 80:80 -v /c/Users/mlin/meinedaten:/c/meinedaten iis cmdclear

but it fails with an error:

docker : docker: Error response from daemon: Invalid bind mount spec "/c/Users/mlin/meinedaten:/c/meinedaten": volumeinvalid: Invalid volume specification:
'/c/Users/mlin/meinedaten:/c/meinedaten'.

Detailed issue report: http://superuser.com/questions/1051520/docker-windows-container-how-to-mount-a-host-folder-as-data-volume-on-windows

I am having the problem on Windows 2016 Server TP4, without using boot2docker, since containers are supported there natively.
I try to mount a folder beneath C:\Users\myuser.. as data volume, like this:

docker run --name iisdemo2 -it -p 80:80 -v /c/Users/mlin/meinedaten:/c/meinedaten iis cmdclear

but it fails with an error:

docker : docker: Error response from daemon: Invalid bind mount spec "/c/Users/mlin/meinedaten:/c/meinedaten": volumeinvalid: Invalid volume specification:
'/c/Users/mlin/meinedaten:/c/meinedaten'.

Detailed issue report: http://superuser.com/questions/1051520/docker-windows-container-how-to-mount-a-host-folder-as-data-volume-on-windows

@thaJeztah

This comment has been minimized.

Show comment
Hide comment
@thaJeztah

thaJeztah Mar 17, 2016

Member

@mathiasconradt I think the "container" path for Windows containers needs to be a regular Windows-style path (forward slashes are accepted though), so

-v /c/Users/mlin/meinedaten:/c:/meinedaten

(c:/meinedaten instead of c/meinedaten)

Member

thaJeztah commented Mar 17, 2016

@mathiasconradt I think the "container" path for Windows containers needs to be a regular Windows-style path (forward slashes are accepted though), so

-v /c/Users/mlin/meinedaten:/c:/meinedaten

(c:/meinedaten instead of c/meinedaten)

@mathiasconradt

This comment has been minimized.

Show comment
Hide comment
@mathiasconradt

mathiasconradt Mar 18, 2016

@thaJeztah Thanks, you are right. I tried C: before but had left the trailing / in the front, which does not work. Not it's working, thanks a lot!

@thaJeztah Note that in this case, the docker documentation should be corrected, because on https://docs.docker.com/engine/userguide/containers/dockervolumes/#mount-a-host-directory-as-a-data-volume it still shows the path pattern incorrectly:

On Windows, mount directories using:

docker run -v /c/Users/[path]:/[container path] ...`

@thaJeztah Thanks, you are right. I tried C: before but had left the trailing / in the front, which does not work. Not it's working, thanks a lot!

@thaJeztah Note that in this case, the docker documentation should be corrected, because on https://docs.docker.com/engine/userguide/containers/dockervolumes/#mount-a-host-directory-as-a-data-volume it still shows the path pattern incorrectly:

On Windows, mount directories using:

docker run -v /c/Users/[path]:/[container path] ...`

@SacredSkull

This comment has been minimized.

Show comment
Hide comment
@SacredSkull

SacredSkull Apr 4, 2016

You can also set an environmental variable to disable path conversion, but note this was ONLY added in Git for Windows.

MSYS_NO_PATHCONV=1 docker run -v ...

It's still a very hacky fix.

http://stackoverflow.com/a/34386471/1160528


Just like in actual Linux, G4W's shell (called mintty) supports .bashrc files - so you can create one (touch ~/.bashrc or vim ~/.bashrc) and add export MSYS_NO_PATH=1.

After that, relaunch your bash and it'll warn you that login scripts are missing, but have been automatically added - and never worry about this again (until it's properly dealt with, at least).

Personally I found that automatic path conversion caused nothing but problems, which is why I've blanket disabled it (in gitbash/mintty). If you find yourself needing it occasionally, just drop a MSYS_NO_PATHCONV=0 infront of the command you need - or, even run export MSYS_NO_PATHCONV=0 to enable it for that session.

A better way to convert paths is to do it explicitly, with cygpath -m /c/cygwin/unixy/path converts to C:/cygwin/unixy/path.

SacredSkull commented Apr 4, 2016

You can also set an environmental variable to disable path conversion, but note this was ONLY added in Git for Windows.

MSYS_NO_PATHCONV=1 docker run -v ...

It's still a very hacky fix.

http://stackoverflow.com/a/34386471/1160528


Just like in actual Linux, G4W's shell (called mintty) supports .bashrc files - so you can create one (touch ~/.bashrc or vim ~/.bashrc) and add export MSYS_NO_PATH=1.

After that, relaunch your bash and it'll warn you that login scripts are missing, but have been automatically added - and never worry about this again (until it's properly dealt with, at least).

Personally I found that automatic path conversion caused nothing but problems, which is why I've blanket disabled it (in gitbash/mintty). If you find yourself needing it occasionally, just drop a MSYS_NO_PATHCONV=0 infront of the command you need - or, even run export MSYS_NO_PATHCONV=0 to enable it for that session.

A better way to convert paths is to do it explicitly, with cygpath -m /c/cygwin/unixy/path converts to C:/cygwin/unixy/path.

@adeelahmadch

This comment has been minimized.

Show comment
Hide comment
@adeelahmadch

adeelahmadch Jan 8, 2017

Error: Invalid volume specification
Info:
Docker 1.12.5
docker-compose version 1.9.0
docker-machine.exe version 0.8.2
Terminal: git bash
OS: Windows 10

Description:
I just want to share my experience here for windows users who use git bash and ran into volume mount issue. i had a similar problem but unlike other people i was facing issue with "docker-compose up" command. In my .yml file i was trying to mount volume like;

volumes:
    - "/e/orchestration-workshop/dockercoins/webui/files/:files/"

i tried everything from // to ' but nothing worked for me. at the end i tried this workaround to make it work.

volumes:
    - "/e/orchestration-workshop/dockercoins/webui/files/"

So when you don't specify volume it use the same name as of your source directory and it worked. now i can see my folder mounted under /files on my docker container.

:-)

Error: Invalid volume specification
Info:
Docker 1.12.5
docker-compose version 1.9.0
docker-machine.exe version 0.8.2
Terminal: git bash
OS: Windows 10

Description:
I just want to share my experience here for windows users who use git bash and ran into volume mount issue. i had a similar problem but unlike other people i was facing issue with "docker-compose up" command. In my .yml file i was trying to mount volume like;

volumes:
    - "/e/orchestration-workshop/dockercoins/webui/files/:files/"

i tried everything from // to ' but nothing worked for me. at the end i tried this workaround to make it work.

volumes:
    - "/e/orchestration-workshop/dockercoins/webui/files/"

So when you don't specify volume it use the same name as of your source directory and it worked. now i can see my folder mounted under /files on my docker container.

:-)

@mirasrael

This comment has been minimized.

Show comment
Hide comment
@mirasrael

mirasrael Jan 12, 2017

@adeelahmadch I found Docker-compose has an option COMPOSE_CONVERT_WINDOWS_PATHS which solves this problem:

COMPOSE_CONVERT_WINDOWS_PATHS=1 docker-compose up -d

mirasrael commented Jan 12, 2017

@adeelahmadch I found Docker-compose has an option COMPOSE_CONVERT_WINDOWS_PATHS which solves this problem:

COMPOSE_CONVERT_WINDOWS_PATHS=1 docker-compose up -d
@laltman2

This comment has been minimized.

Show comment
Hide comment
@laltman2

laltman2 Jan 18, 2017

@mirasrael thanks, this worked for me!

@mirasrael thanks, this worked for me!

@SusrithaMunukutla

This comment has been minimized.

Show comment
Hide comment
@SusrithaMunukutla

SusrithaMunukutla Apr 6, 2017

docker run -itd -p 7776:7776 -v C:/temp/test:C:/testdir --name Test inet-test

This worked for me (y)

Going into Container :

docker exec -it powershell (for windows containers)

docker run -itd -p 7776:7776 -v C:/temp/test:C:/testdir --name Test inet-test

This worked for me (y)

Going into Container :

docker exec -it powershell (for windows containers)

@DanJ210

This comment has been minimized.

Show comment
Hide comment
@DanJ210

DanJ210 May 4, 2017

I couldn't get COMPOSE_CONVERT_WINDOWS_PATHS=1 docker-compose up -d to work I get red errors.

I'm just trying to run a basic tutorial volume thing that gives the above error response from daemon, invalid bind spec or not a valid repository/tag... Maybe someone can tell me how paths are supposed to be typed in via powershell. Like this line below, what am I typing wrong? How would I type that path? Thanks.

docker run -v /c:/Users:/data alpine ls /data

DanJ210 commented May 4, 2017

I couldn't get COMPOSE_CONVERT_WINDOWS_PATHS=1 docker-compose up -d to work I get red errors.

I'm just trying to run a basic tutorial volume thing that gives the above error response from daemon, invalid bind spec or not a valid repository/tag... Maybe someone can tell me how paths are supposed to be typed in via powershell. Like this line below, what am I typing wrong? How would I type that path? Thanks.

docker run -v /c:/Users:/data alpine ls /data

@DanJ210

This comment has been minimized.

Show comment
Hide comment
@DanJ210

DanJ210 May 4, 2017

Or when I try to create a container like this,

docker run -v $(pwd):/app -w /app node npm start I get ":/app" is not a valid repository/tag: invalid reference format.

So I'm not sure what I'm doing wrong to get this to work. I've already got an express app installed and I'm in that directory, that's where the PWD comes in and seems to throw no error. Only the :/app

Just to update, docker run -w C:/Users/djackson/ExpressSite node npm start

Just trying to get something to work but the above tells me Error response from daemon... It needs to be an absolute path and I thought that was an absolute path... This is driving me nuts! Lol.

DanJ210 commented May 4, 2017

Or when I try to create a container like this,

docker run -v $(pwd):/app -w /app node npm start I get ":/app" is not a valid repository/tag: invalid reference format.

So I'm not sure what I'm doing wrong to get this to work. I've already got an express app installed and I'm in that directory, that's where the PWD comes in and seems to throw no error. Only the :/app

Just to update, docker run -w C:/Users/djackson/ExpressSite node npm start

Just trying to get something to work but the above tells me Error response from daemon... It needs to be an absolute path and I thought that was an absolute path... This is driving me nuts! Lol.

@twobob twobob referenced this issue in UoA-eResearch/openface_mass_compare May 12, 2017

Open

where to put images folder, localhost, etc? #1

mabrarov added a commit to mabrarov/build-scripts that referenced this issue Jul 1, 2017

@hugokoka

This comment has been minimized.

Show comment
Hide comment
@hugokoka

hugokoka Oct 2, 2017

I solved it!

Add a volume:

docker run -d -v my-named-volume:C:\MyNamedVolume testimage:latest
Mount a host directory:

docker run -d -v C:\Temp\123:C:\My\Shared\Dir testimage:latest

hugokoka commented Oct 2, 2017

I solved it!

Add a volume:

docker run -d -v my-named-volume:C:\MyNamedVolume testimage:latest
Mount a host directory:

docker run -d -v C:\Temp\123:C:\My\Shared\Dir testimage:latest

@mtpultz

This comment has been minimized.

Show comment
Hide comment
@mtpultz

mtpultz Nov 28, 2017

@DanJ210 did you ever figure out why you were getting that error due to the working directory? I've got the same issue and I can't figure out why it won't work.

mtpultz commented Nov 28, 2017

@DanJ210 did you ever figure out why you were getting that error due to the working directory? I've got the same issue and I can't figure out why it won't work.

@antogerva antogerva referenced this issue in Games-and-Simulations/sc-docker Jan 23, 2018

Closed

chown command doesn't exist on docker toolbox #18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment