这是我的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..
我试过谷歌搜索试图看看我是否犯了任何明显的错误,但到目前为止我还没能识别它。也许你们中的一些人可以提供帮助
编辑:还运行了chmod + x entrypoint.sh来授予权限
答案 0 :(得分:0)
我刚尝试使用以下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"]
它按预期工作。
它不像issue 20789:
我尝试将一个Dockerfile设置从phusion / baseimage转换为gliderslabs / alpine。事实证明,那些shell脚本使用
bash
- 当然!只需更改为sh
,因为bash
不存在,导致上述错误..
最新的debian image应该包含bash,因为其默认CMD
为/bin/bash
。