错误:运行docker容器时无法访问jarfile [英] Error: Unable to access jarfile when running docker container
本文介绍了错误:运行docker容器时无法访问jarfile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试运行docker容器时出现以下错误:
I am getting the following error when trying to run a docker container:
Error: Unable to access jarfile
我的Dockerfile是这样的:
My Dockerfile is like this:
FROM ubuntu:16.04
# Install Updates
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y software-properties-common && \
apt-add-repository -y ppa:openjdk-r/ppa && \
apt-get update -y && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/*
# Install Packages
RUN apt-get -qq update -y && \
apt-get -q install -y \
wget \
openssh-server \
openjdk-8-jdk \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/*
# Add the config files
ADD /apps/ /home/smartling/
# Adding the jar application
ADD /apps/flagship/repo-connector-1.5.4/repo-connector-1.5.4.jar /home/smartling/flagship/repo-connector-1.5.4/
# Making sure the files are there
RUN ls -la /home/smartling/flagship/repo-connector-1.5.4/
# Start the jar file when container launches
CMD ["java","-jar","/home/smartling/flagship/repo-connector-1.5.4/repo-connector-1.5.4.jar -start&"]
然后我建立
docker build -t smartlingflagship .
一切都恢复成功
我运行容器
docker run --rm --name smartlingconn smartlingflagship
它返回时出现以下错误:
And it comes back with the following error:
Error: Unable to access jarfile /home/smartling/flagship/repo-connector-1.5.4/repo-connector-1.5.4.jar -start&
我错过了什么吗?
推荐答案
我能够通过将其添加到底部 ENTRYPOINT [java, - jar,repo-connector-1.5.4.jar]来解决这个问题。
CMD [-start]
I was able to resolve this by adding this to the bottom ENTRYPOINT ["java","-jar","repo-connector-1.5.4.jar"]
CMD ["-start"]
这篇关于错误:运行docker容器时无法访问jarfile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文