您好我正在创建一个docker镜像并且它已经成功但是当我在app.jar上运行它时出错,我在构建过程中添加了它。有什么建议吗?
Docker文件内容
FROM openjdk:alpine
VOLUME /tmp
ADD cta-details-service-1.0.0.jar app.jar
ADD start.sh start.sh
RUN apk add --update bash && rm -rf /var/cache/apk/*
RUN bash -c 'touch /app.jar'
RUN bash -c 'chmod +x /start.sh'
EXPOSE 8090
ENTRYPOINT ["/bin/bash", "/start.sh"]
图片构建日志:
$ docker build -t mpcs/ctl-details-service .
Sending build context to Docker daemon 89.71 MB
Step 1 : FROM openjdk:alpine
---> a7dc136ad22e
Step 2 : VOLUME /tmp
---> Using cache
---> 4b8dcf8f9963
Step 3 : ADD cta-details-service-1.0.0.jar app.jar
---> Using cache
---> b9d84248d3ab
Step 4 : ADD start.sh start.sh
---> 05a56f93e41c
Removing intermediate container 72523c54524d
Step 5 : RUN apk add --update bash && rm -rf /var/cache/apk/*
---> Running in b49b75c3d6f6
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ncurses-terminfo-base (6.0-r7)
(2/5) Installing ncurses-terminfo (6.0-r7)
(3/5) Installing ncurses-libs (6.0-r7)
(4/5) Installing readline (6.3.008-r4)
(5/5) Installing bash (4.3.42-r3)
Executing bash-4.3.42-r3.post-install
Executing busybox-1.24.2-r9.trigger
OK: 149 MiB in 40 packages
---> 5318da18a15d
Removing intermediate container b49b75c3d6f6
Step 6 : RUN bash -c 'touch /app.jar'
---> Running in f914f0b2ecd2
---> e3aa35585f02
Removing intermediate container f914f0b2ecd2
Step 7 : RUN bash -c 'chmod +x /start.sh'
---> Running in 722749bbcc10
---> 647463ac0982
Removing intermediate container 722749bbcc10
Step 8 : EXPOSE 8090
---> Running in 7194e3b95ee6
---> c52f3648f921
Removing intermediate container 7194e3b95ee6
Step 9 : ENTRYPOINT /bin/bash /start.sh
---> Running in 0d30553ed406
---> adede39132c8
Removing intermediate container 0d30553ed406
Successfully built adede39132c8
SECURITY WARNING: You are building a Docker image from Windows against a non-Win
dows Docker host. All files and directories added to build context will have '-r
wxr-xr-x' permissions. It is recommended to double check and reset permissions f
or sensitive files and directories.
Docker运行错误:
$ docker run -p 8090:8090 -t mpcs/ctl-details-service
Error: Unable to access jarfile /app.jar