Ubuntu 错误:运行docker容器时无法访问jarfile

Ubuntu 错误:运行docker容器时无法访问jarfile,ubuntu,docker,jar,Ubuntu,Docker,Jar,尝试运行docker容器时,我遇到以下错误: Error: Unable to access jarfile 我的Dockerfile如下所示: FROM ubuntu:16.04 # Install Updates RUN apt-get update -y && \ apt-get upgrade -y && \ apt-get install -y software-properties-common && \

尝试运行docker容器时,我遇到以下错误:

Error: Unable to access jarfile
我的Dockerfile如下所示:

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
它会返回以下错误:

Error: Unable to access jarfile /home/smartling/flagship/repo-connector-1.5.4/repo-connector-1.5.4.jar -start&

我遗漏了什么吗?

您能检查一下以下回复吗: “运行ls-la/home/smartling/flagship/repo-connector-1.5.4/”

检查文件(repo-connector-1.5.4.jar)是否具有运行所需的权限。如果没有,请使用chmod并授予jar权限

命令如下:
运行[“chmod”、“+x”、“/home/smartling/flagship/repo-connector-1.5.4/repo-connector-1.5.4.jar”]

在#确保文件存在后放置上述命令

运行ls-la/home/smartling/flagship/repo-connector-1.5.4/

我可以通过将其添加到底部
入口点[“java”、“-jar”、“repo-connector-1.5.4.jar”]来解决这个问题

CMD[“-start”]

它不起作用。还是一样的错误。在构建的输出中,文件权限是(-rwxr-xr-x 1 root根217456 2016年10月19日repo-connector-1.5.4.jar)您好,teej2542,我看到您正在使用-start&运行jar。Docker需要至少1个在前台运行的进程才能启动。你能在前台而不是后台运行这个jar吗。