没有find或不存在的Docker容器命令
我有Docker的麻烦。
这是我的DockerFile
FROM alpine:3.3 WORKDIR / COPY myinit.sh /myinit.sh ENTRYPOINT ["/myinit.sh"]
myinit.sh
#!/bin/bash set -e echo 123
那是我build立我的形象的方式
docker build -t test --no-cache
运行日志
Sending build context to Docker daemon 3.072 kB Step 1 : FROM alpine:3.3 ---> d7a513a663c1 Step 2 : WORKDIR / ---> Running in eda8d25fe880 ---> 1dcad4f11062 Removing intermediate container eda8d25fe880 Step 3 : COPY myinit.sh /myinit.sh ---> 49234cc3903a Removing intermediate container ffe6227c921f Step 4 : ENTRYPOINT /myinit.sh ---> Running in 56d3d748b396 ---> 060f6da19513 Removing intermediate container 56d3d748b396 Successfully built 060f6da19513
多数民众赞成在我如何运行容器
docker run --rm --name test2 test docker: Error response from daemon: Container command '/myinit.sh' not found or does not exist..
myinit.sh肯定存在。 这是ls -al
ls -al total 16 drwxr-xr-x 4 lorddaedra staff 136 10 май 19:43 . drwxr-xr-x 25 lorddaedra staff 850 10 май 19:42 .. -rw-r--r-- 1 lorddaedra staff 82 10 май 19:51 Dockerfile -rwxr-xr-x 1 lorddaedra staff 29 10 май 19:51 myinit.sh
为什么不能看到我的入口点脚本? 任何解决scheme
谢谢
这不是它无法find的入口点脚本,而是它引用的shell – alpine:3.3在默认情况下不会有bash。 将您的myinit.sh
更改为:
#!/bin/sh set -e echo 123
即引用/bin/sh
而不是/bin/bash