本文介绍了找不到或不存在容器命令“ /start.sh”,容器的入口点是shell脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
项目内容:
rob@work:~/git/proj $ ls
lib node_modules props.json start.sh
app.js Dockerfile package.json README.md
start.sh
..
rob@work:~/git/proj $ cat start.sh
#/bin/bash
# do things
/some/other/stuff
echo "Starting app .."
node app.js
Dockerfile
..
FROM somewhere.com/dependencyProj
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
COPY props.json /etc/someService.d/props.json
EXPOSE 4101
ENTRYPOINT ["/start.sh"]
构建docker映像:
Build docker image:
rob@work:~/git/proj $ docker build -t dx/proj:0.0.1 .
Sending build context to Docker daemon 59.99 MB
Step 1 : FROM somewhere.com/dependencyProj
latest: Pulling from dependencyProj
420890c9e918: Already exists
8ff1af46fe3d: Already exists
6db3a1c6f4ca: Already exists
d82a90c4ea1b: Already exists
f32685681727: Already exists
797dfb291196: Already exists
3a713b0b523e: Already exists
a9c617bff63b: Already exists
9ab84732ac6e: Already exists
2a85e0afdd4d: Already exists
a56b24146ce4: Already exists
0a91b00da1f7: Already exists
836b0e7c1105: Already exists
Digest: sha256:36b7a32bd12b85cbb2fb3203d43807c9b8735d6ceb50d813b76bfe2e5c3ebeb4
Status: Downloaded newer image for somewhere.com/dependencyProj:latest
---> 7c52bbbc3feb
Step 2 : RUN mkdir -p /usr/src/app
---> Running in aab7cf1f7974
---> 250317f63adf
Removing intermediate container aab7cf1f7974
Step 3 : WORKDIR /usr/src/app
---> Running in f60088532610
---> 60f3d9fe88c4
Removing intermediate container f60088532610
Step 4 : COPY . /usr/src/app
---> 004e0a440fb5
Removing intermediate container f247d134d88b
Step 5 : COPY props.json /etc/someService.d/props.json
---> 03b48249c94c
Removing intermediate container a3636849765d
Step 6 : EXPOSE 4101
---> Running in 0056e5c20264
---> 867765176927
Removing intermediate container 0056e5c20264
Step 7 : ENTRYPOINT /start.sh
---> Running in 80ae316b0629
---> d1e65def77ce
Removing intermediate container 80ae316b0629
Successfully built d1e65def77ce
运行docker image:
Run docker image:
rob@work:~/git/proj $ docker run -d dx/proj:0.0.1
0fd1f8087cc5be3e085454cf99b7a3795b9ce15909b0f416ae39380f93feaa44
docker: Error response from daemon: Container command '/start.sh' not found or does not exist..
推荐答案
您遇到了一些问题:
-
您必须使用
./ start.sh
从当前目录运行start.sh
文件。/start.sh
在根目录/
中运行start.sh
,这不存在。
You must use
./start.sh
to run thestart.sh
file from current directory./start.sh
runstart.sh
in root/
, which does not exist.
您在 start.sh
脚本中的shebang行是错误的,必须是#!/ bin / bash
。
Your shebang line in start.sh
script is wrong, it's must be #!/bin/bash
.
还必须设置<$ c $的可执行权限c> start.sh ,通过运行 chmod + x start.sh
。
You also must set executable permission for start.sh
, by running chmod +x start.sh
.
这篇关于找不到或不存在容器命令“ /start.sh”,容器的入口点是shell脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!