This is my Dockerfile:
FROM openjdk:8
EXPOSE 8080
ADD target/springboot-example.jar springboot-example.jar
ENTRYPOINT ["java","-jar","/springboot-example.jar"]
While running docker build
, I see this error:
Step 3/4 : ADD target/springboot-example.jar springboot-example.jar
ADD failed: file not found in build context or excluded by .dockerignore: stat target/springboot-example.jar: file does not exist
I solved the problem by specifying relative path instead of absolute path.
My DockerFile and all other files were at "/root/files" directory and I was inside "/root/files" directory.
Earlier I had below statement in Dockerfile,
which I changed to,
This worked.