kakabali
kakabali

Reputation: 4033

Docker COPY issue while building the docker image

I have a project which is Maven based multi module project

It has various modules with in, like common-utils, web, theme, etc, etc

And also in the root location it has the Dockerfile which is not default one but I have named it Dockerfile.cli due to some requirements

Dockerfile.cli contents here:-

FROM tomcat

ENV NEUW_LOG_HOME /neuw/web/logs

RUN echo "running the image, making it a container :-)"

RUN mkdir -p "/neuw/web/theme-v4"

COPY web/target/web.war /usr/local/tomcat/webapps/ROOT.war

COPY theme-v4 /neuw/web/theme-v4

CMD ["catalina.sh", "jpda", "run"]

Now why I am here -> am getting the below error while building the image:-

COPY failed: stat /var/lib/docker/tmp/docker-builder838877607/web/target/web.war: no such file or directory

The command I use to run the image build is like below and running it on the root of the project which contains both theme and web folder:-

docker build -f Dockerfile.cli -t neuw/web:snapshot-30 .

Any hints and help for the issue?

Upvotes: 2

Views: 809

Answers (1)

Ryan Dawson
Ryan Dawson

Reputation: 12558

Which directory are you in when you run this command? Could you do ls /web/target/ from that directory? I ask because I think your Dockerfile is expecting to find a web.war in ./web/target relative to the directory you are running in.

Edit (to save anyone digging through the comments on this): The target directory did contain the file but it was invisible to docker due to a .dockerignore file with **/target.

Upvotes: 1

Related Questions