Dockerfile抛出错误"没有这样的文件或目录"

时间:2017-11-24 18:41:03

标签: docker dockerfile

我的docker文件看起来像

FROM grpc/python
CMD ["/bin/ls /"]

这是一个错误:

container_linux.go:265: starting container process caused "exec: \"/bin/ls /\": stat /bin/ls /: no such file or directory"
docker: Error response from daemon: oci runtime error: container_linux.go:265: starting container process caused "exec: \"/bin/ls /\": stat /bin/ls /: no such file or directory".

2 个答案:

答案 0 :(得分:1)

您需要将命令与参数分开:

CMD ["/bin/ls", "/"]

CMD接受以下格式:

CMD ["executable","param1","param2"] (exec form, this is the preferred form)
CMD ["param1","param2"] (as default parameters to ENTRYPOINT)
CMD command param1 param2 (shell form)

答案 1 :(得分:-2)

第二行ls命令中的CMD后面有额外空格