Docker容器命令找不到shell脚本
这是我的Dockerfile:
FROM debian MAINTAINER Andrew Ford<andrew.ford@gg.com> RUN apt-get update COPY entrypoint.sh / ENTRYPOINT ["/entrypoint.sh"]
这里是我的entrypoint.sh(与Dockerfile相同的目录)
#!/bin/bash echo Hello
然后我跑了:
docker build --no-cache=true -t test/dockerfile-sayhello .
当我跑时:
docker run test/dockerfile-sayhello
它返回:
C:\Program Files\Docker Toolbox\docker.exe: Error response from daemon: Container command '/entrypoint.sh' not found or does not exist..
我曾试着用Googlesearch来看看我是否犯了明显的错误,但到目前为止我还没有find它。 也许你们中的一些人可以帮忙
编辑:也运行chmod + x的entrypoint.sh给予权限
我只是试着用下面的Dockerfile(添加chmod
)
FROM debian MAINTAINER Andrew Ford<andrew.ford@gg.com> RUN apt-get update COPY entrypoint.sh / RUN chmod 755 /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]
它按预期工作。
这不是问题20789 :
我试图将一个Dockerfile设置从phusion / baseimage转换为gliderslabs / alpine。 原来那些shell脚本使用
bash
– 当然! 只要改变为sh
,因为bash
不存在,导致上述错误。
最新的debian映像应该包含bash,因为它的默认CMD
是/bin/bash
。
- 引用传递给docker入口点的第一个参数?
- Docker在不同的容器中运行相同的VPN服务,并负载平衡这些请求
- 在Docker中映射卷
- 在ubuntubase docker上运行postgres时出错
- jenkins:pipe道docker工作与jenkins文件 – docker常规语法
- 为什么dockerbuild设需要这么长时间才能运行?
- Dockerfile CMD不接受variables
- 我怎样才能将Jenkins这样的应用程序安装到使用chef-recipe的CentOs映像中运行的正在运行的CentOs容器中?
- 在构builddocker映像时找不到有效的基础版repo:base / 7 / x86_64