1
  • 我想在 Windows 下的 Git Bash 中运行 docker。
  • 如果docker run --rm -ti -v my-vol:/myvol my_volume_test:latest在 Cmd/Powershell 下使用,一切都很好。
  • 但是要docker在 Git Bash 下使用,我需要在命令前加上winpty,这就是问题所在:
     $ 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'.

我试图逃避 ':' 字符,但这也不起作用:

$ 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'.
4

0 回答 0