I am getting the following error when trying to run a docker container:
Error: Unable to access jarfile
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&"]
Then I build
docker build -t smartlingflagship .
Everything comes back successful
The I run the container
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&
Am I missing anything?
Could you please check the response of : "RUN ls -la /home/smartling/flagship/repo-connector-1.5.4/"
Check if the file(repo-connector-1.5.4.jar) is having the required permission to run. If not please use chmod and grant the jar the permission.
Command is as follow:
RUN ["chmod", "+x", "/home/smartling/flagship/repo-connector-1.5.4/repo-connector-1.5.4.jar"]
Place the above command after # Making sure the files are there
RUN ls -la /home/smartling/flagship/repo-connector-1.5.4/
I was able to resolve this by adding this to the bottom
ENTRYPOINT ["java","-jar","repo-connector-1.5.4.jar"] CMD ["-start"]