Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to access jarfile when running Docker image

I am novice to Spring Boot Microservices and Docker.

The dockerfile in microservice project:

dockerfile

docker build:

docker build

docker images:

docker images

when running the image, there is an error: Unable to access jarfile register_server.jar

error

Cheers, Sean

like image 741
Sean Sun Avatar asked Aug 30 '16 01:08

Sean Sun


People also ask

How do I access JarFile?

Open File Explorer and the folder that includes your JarFile. Right-click the Jar file and select Open with then Choose another app. Select Java if it's listed among the default programs.

What is the difference between entrypoint and CMD in Docker?

Differences between CMD & ENTRYPOINT CMD commands are ignored by Daemon when there are parameters stated within the docker run command while ENTRYPOINT instructions are not ignored but instead are appended as command line parameters by treating those as arguments of the command.


1 Answers

You need to specify either the absolute target path or set the WORKDIR

Dockerfile Reference - Add

https://docs.docker.com/engine/reference/builder/#add

The <dest> is an absolute path, or a path relative to WORKDIR, into which the source will be copied inside the destination container. For example:

ADD test relativeDir/          # adds "test" to `WORKDIR`/relativeDir/
ADD test /absoluteDir/         # adds "test" to /absoluteDir/ 
like image 86
DevOps Dan Avatar answered Sep 28 '22 01:09

DevOps Dan