简体   繁体   中英

docker file not found

I am creating a docker image of a maven project. Here is the docker file

FROM java:8
# Install maven
RUN apt-get update
RUN apt-get install -y maven

WORKDIR ~/mmt/CouchBaseClient/CB-RestAPI/CacheService

# Prepare by downloading dependencies
#ADD pom.xml /mmt/CouchBaseClient/CB-RestAPI/CacheService/pom.xml
#RUN ["mvn", "dependency:resolve"]
#RUN ["mvn", "verify"]
ADD cacheService-0.0.1-SNAPSHOT.jar /target/cacheService-0.0.1-SNAPSHOT.jar
EXPOSE 4567
CMD ["/usr/lib/jvm/java-8-openjdk-amd64/bin/java", "-jar", "target/couchclient-0.0.1-SNAPSHOT.jar server cacheService.yml]

When I run the following command to build my image

 sudo docker build -t myimage .

I get the following error

 Step 5 : ADD cacheService-0.0.1-SNAPSHOT.jar /target/cacheService-0.0.1-SNAPSHOT.jar
 lstat cacheService-0.0.1-SNAPSHOT.jar: no such file or directory

But I have my file there..How do i go about it

Make sure you have cacheService-0.0.1-SNAPSHOT.jar in the same folder as your Dockerfile .

That way, it will be part of your docker build context when you do a sudo docker build -t myimage .

The "source" (in " ADD <source> <destination> ") is a relative path to the PATH used in docker build (here ' . ': current directory).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM