Docker Windows-在bash位置查找Ubuntu命令
新来的码头工人。下载并安装在Windows 7上的DockerToolbox-1.10.2.exe似乎运行正常 在以下位置尝试hello world教程: 当我运行以下命令时Docker Windows-在bash位置查找Ubuntu命令,windows,ubuntu,docker,Windows,Ubuntu,Docker,新来的码头工人。下载并安装在Windows 7上的DockerToolbox-1.10.2.exe似乎运行正常 在以下位置尝试hello world教程: 当我运行以下命令时 $ docker run ubuntu /bin/echo 'Hello world' 它似乎下载了Ubuntu图像: Unable to find image 'ubuntu:latest' locally latest: Pulling from library/ubuntu 5a132a7e7af1: Pull
$ 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到运行docker。我敢肯定这一定是配置问题,但我不确定从这里开始该怎么办。您可能有一个路径,该路径在其他路径之前,首先包含
c:\devel\Git
,使shell调用错误的回显。尝试更改顺序(
设置路径=…;c:\devel\Git
)
确保首先连接到计算机:
docker-machine ssh
然后您可以再次尝试docker run命令尝试
docker run ubuntu//bin/echo“Hello world”
简短回答
使用/
转义命令中的unix样式路径。下面的工作
$ docker run ubuntu //bin/echo 'Hello world'
Hello world
更长的答案 这种行为背后的原因似乎是Git Bash(基于MinGW64/)在找到unix风格的路径时试图进行一些智能的路径转换。我只找到了转换的源代码(我相信),但没有文档。我在上面找到的唯一文档是for,应该是类似的 让我引用截图。从示例中可以看到,像
/bar
这样的“unix风格”路径将被重新写入MSYS2根目录的相对路径(即Git Bash中的Git目录),而像/foobar
这样的转义路径将按原样传递
docker machine ssh成功了。我一定错过了那一步。谢谢你的帮助。@javatestcase没问题。我发现,在Windows上,我所需要的只是docker机器(复制自)。我甚至都不在乎docker工具箱。