项目内容:
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"]
构建泊坞窗图像:
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:
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..
最佳答案
原文链接:https://www.f2er.com/docker/435963.html