winpty
winpty copied to clipboard
Specifying named docker volume causes includes invalid characters problem
- 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 withwinpty
, 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'.
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
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.
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
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 ;
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?