![](/img/trans.png)
[英]Location of .bashrc for "Bash on Ubuntu on Windows" in Windows 10
[英]Docker Windows - Looking for Ubuntu command in bash location
Docker的新手。 已下载并已安装在Windows 7上的DockerToolbox-1.10.2.exe似乎运行正常。
在以下位置尝试打招呼世界教程:
当我运行以下命令
$ docker run ubuntu /bin/echo 'Hello world'
似乎正在下载Ubuntu映像:
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
5a132a7e7af1: Pull complete
fd2731e4c50c: Pull complete
28a2f68d1120: Pull complete
a3ed95caeb02: Pull complete
Digest: sha256:4e85ebe01d056b43955250bbac22bdb8734271122e3c78d21e55ee235fc6802d
Status: Downloaded newer image for ubuntu:latest
但随后出现以下错误消息:
exec: "C:/devel/Git/bin/echo": stat C:/devel/Git/bin/echo: no such file or directory
docker: Error response from daemon: Container command not found or does not exist
该路径是我在Windows中从中运行bash.exe来运行docker的位置。 我确定这一定是配置问题,但是我不确定从这里出发。
您可能有一个PATH,该PATH首先包含c:\\devel\\Git
,然后使外壳程序调用错误的echo。
尝试更改该顺序( set PATH=...;c:\\devel\\Git
)。
确保首先连接到计算机:
docker-machine ssh
然后您可以再试一次docker run命令
使用/
在命令中转义unix样式的路径。 以下作品。
$ docker run ubuntu //bin/echo 'Hello world'
Hello world
此行为背后的原因似乎是Git Bash(基于MinGW64 / MSYS2 )在找到unix样式的路径时尝试进行一些智能路径转换 。 我只找到了转换的源代码(我相信在这里 ),但是没有文档。 我在此找到的唯一文档是有关MSYS1路径转换的 ,应该类似。
让我通过屏幕快照引用MSYS1路径转换 。 从该示例中可以看到,像/bar
这样的“ unix风格”路径将被重写为MSYS2根目录(即,对于Git Bash而言为Git目录)的相对路径,而一个转义路径则为//foobar
按原样通过。
试试docker run ubuntu //bin/echo 'Hello world'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.