【问题标题】:Dockerfile throwing an error "no such file or directory"Dockerfile 抛出错误“没有这样的文件或目录”
【发布时间】:2017-11-25 02:46:57
【问题描述】:

我的 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".

【问题讨论】:

    标签: docker dockerfile


    【解决方案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)
    

    【讨论】:

      【解决方案2】:

      在第二行的CMD 命令中ls 之后有额外的空间

      【讨论】:

      • 那是因为我打算 ls 根目录。
      猜你喜欢
      • 2014-03-08
      • 1970-01-01
      • 2020-11-07
      • 1970-01-01
      • 1970-01-01
      • 2019-03-17
      • 1970-01-01
      • 1970-01-01
      • 2010-12-04
      相关资源
      最近更新 更多