docker-archive / toolbox

The Docker Toolbox
https://docker.com/toolbox
3.22k stars 1.23k forks source link

Unable to use Windows paths for mount (source) #742

Open nmschulte opened 6 years ago

nmschulte commented 6 years ago
  1. docker pull debian:sid-slim
  2. docker run --rm -it --mount type=bind,source=C:\\Users\\nmschulte,target=/nmschulte debian:sid-slim
  3. ???
  4. ~profit~ receive error
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: invalid mount config for type "bind": invalid mount path: 'C:/Users/nmschulte' mount path must be absolute.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

Supplying a POSIX path works (because the daemon is running under *nix VM), but the Docker Toolbox kit should be doing this path translation automatically: docker run --rm -it --mount type=bind,source=/c/Users/nmschulte,target=/nmschulte debian:sid-slim

Without this translation, and with no way to distinguish between Docker and Docker Toolbox platforms, one cannot create a cross-platform script to execute Docker.


I assume not, given that C:\Users is pre-configured in Docker Toolbox to be shared with the VirtualBox *nix VM, but is there a facility to auto-share folders from mount/bind-volume specification, or a tool (binary, script) that can configure this (given param arguments)?


docker -v Docker version 18.03.0-ce, build 0520e24302

hsluoyz commented 6 years ago

Without this translation, and with no way to distinguish between Docker and Docker Toolbox platforms, one cannot create a cross-platform script to execute Docker.

@nmschulte, I'm encountering the same issue as you. I found a post that provided a way to distinguish between Docker and Docker Toolbox. Hope it helps: https://stackoverflow.com/questions/43242218/how-can-a-script-distinguish-docker-toolbox-and-docker-for-windows

bhutten14 commented 5 years ago

I managed to get it working by adding a shared folder in the VirtualBox VM: vboxmanage sharedfolder add default --name "c" --hostpath "c:\" --automount This way absolute windows paths can be used, like in this case: /c/Users/nmschulte

FatBobGo commented 5 years ago

@bhutten14 I hit the same issue, and not able to resolve.

I have been try lots of combination of the volumes parm in the source code, but still not able to get it work.

with your command typed in Virtual Toolbox, I got no reponse after entering the command line. Do you have any idea?

volumes={folder: {'bind': 'd:/vmPyWork', 'mode': 'rw'}}

image

forcage commented 5 years ago

Double the backslash in hostpath.

roshanpal commented 5 years ago

@forcage Doubling bachslash didn't work for me. The destination dir was empty.

nmschulte commented 5 years ago

There is no automatic way to resolve this; you'll have to work around it by managing the shared folders in VirtualBox for the Docker VM, and be aware of this discrepancy when issuing commands from Windows to the Unix Docker host; any Windows paths will need to be specified as the corresponding shared folder name in VirtualBox.

Also, you should stop using Docker Toolbox because issues like this will not be resolved; as I understand the project is no longer maintained.

forcage commented 5 years ago

I am stuck with Docker Toolbox indefinitely as Desktop is not willing to be installed on Windows 10 Enterprise. [https://github.com/docker/hub-feedback/issues/1532] Using a full-fledged Linux virtual machine for Docker-related work is not much better than Toolbox.

sferry commented 4 years ago

This vboxmanage sharedfolder add default --name "c" --hostpath "c:\" --automount worked for me! Thanks!

dreplica commented 4 years ago

docker run --env DATA_PATH=/data/num.txt --mount type=volume,src=my-node-app,target=/data/txt my-node-app

when run i get this error:

C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: invalid mount config for type "volume": invalid mount path: 'C:/Program Files/Git/data/txt' mount path must be absolute. See 'C:\Program Files\Docker\Docker\resources\bin\docker.exe run --help'.

any help?

aalster commented 4 years ago

docker run --env DATA_PATH=/data/num.txt --mount type=volume,src=my-node-app,target=/data/txt my-node-app

when run i get this error:

C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: invalid mount config for type "volume": invalid mount path: 'C:/Program Files/Git/data/txt' mount path must be absolute. See 'C:\Program Files\Docker\Docker\resources\bin\docker.exe run --help'.

any help?

Have same issue. Did you figure it out?

thaJeztah commented 4 years ago

@aalster try using a double-slash at the start of that path to prevent msys2 doing it's "magic" conversion; http://www.mingw.org/wiki/Posix_path_conversion

Or set the MSYS_NO_PATHCONV=1 environment variable in your shell

sferry commented 4 years ago

Hello, I did manage, but I did not continue to work with it. What I have in my notes :

Launch a PS command : PS > .\VBoxManage.exe sharedfolder add default --name "w" --hostpath "W:\" --automount From (https://github.com/docker/toolbox/issues/742)

And launch : PS> docker run -it --rm -v /w/WCommon:/data -e DISPLAY=192.168.56.1:0.0 project_name

Hope it helps Sophie

De : Sebastiaan van Stijn notifications@github.com Envoyé : mardi 28 avril 2020 17:24 À : docker/toolbox toolbox@noreply.github.com Cc : FERRY Sophie sophie.ferry@cea.fr; Comment comment@noreply.github.com Objet : Re: [docker/toolbox] Unable to use Windows paths for mount (source) (#742)

@aalsterhttps://github.com/aalster try using a double-slash at the start of that path to prevent msys2 doing it's "magic" conversion; http://www.mingw.org/wiki/Posix_path_conversion

Or set the MSYS_NO_PATHCONV=1 environment variable in your shell

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/docker/toolbox/issues/742#issuecomment-620675279, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABOURDBJW7YA45XAN5OMB6TRO3YINANCNFSM4EXQMTPA.

katja-brunner commented 4 years ago

docker run --env DATA_PATH=/data/num.txt --mount type=volume,src=my-node-app,target=/data/txt my-node-app

when run i get this error:

C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: invalid mount config for type "volume": invalid mount path: 'C:/Program Files/Git/data/txt' mount path must be absolute. See 'C:\Program Files\Docker\Docker\resources\bin\docker.exe run --help'.

any help?

Try a double backslash in the beginning of your target path like that docker run --env DATA_PATH=/data/num.txt --mount type=volume,src=my-node-app,target=//data/txt my-node-app