Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying named docker volume causes includes invalid characters problem #178

Open
suntong opened this issue Apr 1, 2020 · 5 comments
Open

Comments

@suntong
Copy link

suntong commented Apr 1, 2020

  • I want to run docker in Git Bash under Windows.
  • If use docker run --rm -ti -v my-vol:/myvol my_volume_test:latest under Cmd/Powershell, all is good.
  • But to use docker under Git Bash, I need to prefix the command with winpty, that's where the problem comes in:
     $ winpty docker run --rm -ti -v my-vol:/myvol my_volume_test:latest
     C:/Program Files/Docker/Docker/resources/bin/docker.exe: Error response from daemon: create my-vol;C: "my-vol;C" 
     includes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended
     to pass a host directory, use absolute path.
     See 'C:/Program Files/Docker/Docker/resources/bin/docker.exe run --help'.

I tried to escape the ':' character, but that didn't work either:

$ winpty docker run --rm -ti -v my-vol\:/myvol my_volume_test:latest
C:/Program Files/Docker/Docker/resources/bin/docker.exe: Error response from daemon: create my-vol;C: "my-vol;C" i
ncludes invalid characters for a local volume name, only "[a-zA-Z0-9][a-zA-Z0-9_.-]" are allowed. If you intended
to pass a host directory, use absolute path.
See 'C:/Program Files/Docker/Docker/resources/bin/docker.exe run --help'.
@suntong suntong changed the title Windows docker, specifying named volume under winpty command line causing includes invalid characters problem Specifying named volume causes includes invalid characters problem Apr 1, 2020
@suntong suntong changed the title Specifying named volume causes includes invalid characters problem Specifying named docker volume causes includes invalid characters problem Apr 1, 2020
@odupuy
Copy link

odupuy commented Aug 13, 2021

I have similar issue

Running a makefile using the "terminal" of IntelliJ using git bash on W10 and Docker desktop.
This was working without winpty under W7 and Docker toolbox.
The current folder (pwd) is /c/Users/1005xxx/myfolder
The error is the same under Git bash (without IntelliJ)

winpty docker run --user 111111:222222 -ti -v "/c/Users/1005xxx/myfolder:/work" containername prototool generate --walk-timeout 30s
=>
docker: Error response from daemon: OCI runtime create failed: invalid mount {Destination:\Programs\Git\work Type:bind Source:/run/desktop/mnt/host/c/Users/1005xxx/myfolder;C Options:[rbind rprivate]}: mount destination \Programs\Git\work not absolute: unknown.
make: *** [Makefile:90: gen-go-proto] Error 125

If I remove winpty the error is the same under IntelliJ.

Under bash directly, it is different
/c/Programs/Docker/Docker/resources/bin/docker run --user 111111:222222 -ti -v "/c/Users/1005xxxmyfolder:/work" mycontainer prototool generate --walk-timeout 30s
=>
the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty

The ugly alternative for now is to do it directly in a good auld CMD and to forget the makefile
"C:\Programs\Docker\Docker\resources\bin\docker.exe" run --user 111111:222222 -ti -v "/c/Users/1005xxx/myfolder:/work" containername prototool generate --walk-timeout 30s

@k-takata
Copy link

It's not a winpty issue. MSYS2 automatically converts a Unix-style path to a Windows-style path when executing a non-msys2 program. And it can be controlled by the MSYS2_ARG_CONV_EXCL environment variable.
See https://www.msys2.org/wiki/Porting/#filesystem-namespaces for detail.

@suntong
Copy link
Author

suntong commented Aug 14, 2021

Oh, thanks a lot @k-takata!

@odupuy, I don't have the environment any more, would you test it out and let us know please?

Basically you need to run the following two commands:

winpty docker run --user 111111:222222 -ti -v "/c/Users/1005xxx/myfolder:/work" containername prototool generate --walk-timeout 30s
MSYS2_ARG_CONV_EXCL='*' winpty docker run --user 111111:222222 -ti -v "/c/Users/1005xxx/myfolder:/work" containername prototool generate --walk-timeout 30s

and let us know the results.

Thanks

@odupuy
Copy link

odupuy commented Aug 16, 2021

Thanks folks.

I modified my makefile, the variable MSYS... is set, I can see it logged but the error is the same aka

docker: Error response from daemon: OCI runtime create failed: invalid mount {Destination:\Programs\Git\work Type:bind Source:/run/desktop/mnt/host/c/Users/1005xxx/myfolder;C Options:[rbind rprivate]}: mount destination \Programs\Git\work not absolute: unknown.
make: *** [Makefile:90: gen-go-proto] Error 125

$ make --version
GNU Make 4.3
Built for Windows32
Copyright (C) 1988-2020 Free Software Foundation, Inc.
$ uname -o
Msys
MYNAME@c-BP5D7C3 MINGW64 ~/go/gitlab.protectv.local/dpaas/slingshot (master)
$ uname -a
MINGW64_NT-10.0-18363 MYPC 3.1.7-340.x86_64 2021-03-26 22:17 UTC x86_64 Msys
msys_version := 3 ;

@k-takata
Copy link

What was the result when you ran MSYS2_ARG_CONV_EXCL='*' winpty docker run --user 111111:222222 -ti -v "/c/Users/1005xxx/myfolder:/work" containername prototool generate --walk-timeout 30s from bash?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants