Docker build not picking up built jar? I am new to the DevOps world but I am trying to build a pipeline using Jenkins and Docker. 

I have Jenkins building the docker image by:

docker build -f Dockerfile --build-arg jenkins_jar_file=${JENKINS_JAR_FILE} -t ${DOCKER_IMAGE} .


Where JENKINS_JAR_FILE is a variable that points to the jar file produced by Jenkins

This is my Dockerfile:

FROM ~~container_on_private_registry~~
USER root
WORKDIR /root
ARG jenkins_jar_file
RUN mkdir -p /root/app/app.jar
COPY ${jenkins_jar_file} /root/app/app.jar
ENTRYPOINT ["java", "-jar", "/root/app/app.jar"]


However, I feel like the image is not being built with the right JAR? 
I run docker images and see my image - but it says "Created 4 Days ago"
I see the same thing when I run docker images histroy for the entrypoint step. 

When I actually try to run the image against a container, it for some odd reason tries to run against a jar which doesn't exist in the image. Instead it returns the following error:
/root/app-1.0-20180729.204127-14 

Any help appreaciated :)
It seems to me that your Dockerfile should be looking like this:

FROM ~~container_on_private_registry~~
USER root
WORKDIR /root
ARG jenkins_jar_file=jenkins.jar
ENV jenkins_jar_file ${jenkins_jar_file}
RUN mkdir -p /root/app
COPY ${jenkins_jar_file} /root/app/app.jar
ENTRYPOINT ["java", "-jar", "/root/app/app.jar"]


Explanation:

We tell the Dockerfile to let Docker know, that it expects a variable named jenkins_jar_file to be passed to it during the build. Subsequent lines can reference that variable with a dollar notation.

Also when you build the image, use --no-cache so it will re-build all the layers of the image.