Sean Sun
Sean Sun

Reputation: 546

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

Upvotes: 8

Views: 26922

Answers (1)

DevOps Dan
DevOps Dan

Reputation: 1853

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/ 

Upvotes: 5

Related Questions