Docker –mount抛出:$ PATH中找不到可执行文件“

运行:

docker run 6740371b6542 --mount docker run 6740371b6542 --mount source=aws,target=/root/.aws/,readonly 

两者都产生相同的错误:

 container_linux.go:265: starting container process caused "exec: \"--mount\": executable file not found in $PATH" docker: Error response from daemon: oci runtime error: container_linux.go:265: starting container process caused "exec: \"--mount\": executable file not found in $PATH". 

有人可以解释如何从主机装入一个文件/文件夹到docker集装箱? 看来 – 完成是目前/最新推荐的方式来做到这一点。

切换参数的顺序应该解决docker run --mount source=aws,target=/root/.aws/,readonly 6740371b6542问题docker run --mount source=aws,target=/root/.aws/,readonly 6740371b6542

docker运行作为其最后一个参数执行一个命令。 您收到的错误是由于容器不知道--mount命令是什么

将来,如果你想在一个容器中运行一个命令,如果你想保存pathvariables,不要忘了使用bash

docker run --mount source=aws,target=/root/.aws/,readonly 6740371b6542 /bin/bash -c mysql