Windows下使用Docker,直接使用cmd进容器不会有这个提示

但是你可能会想用git的bash来进入,毕竟看起来更linux一点。。

进入的时候会提示:

the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'

如果你按照他的提示在前面加上winpty,会提示:

OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused "exec: \"C:/Program Files/Git/sh\": stat C:/Program Files/Git/sh: no such file or directory": unknown

个人猜测是因为最后一个参数被识别成了windows下的路径进行了转换操作。

解决方法也很简单,进容器的时候把/bin/sh或/bin/bash改成 sh 以及 bash,就可以了~