Amarjeet Kaur
Amarjeet Kaur

Reputation: 157

How to fix error "COPY failed: stat /var/lib/docker/tmp/docker-builder/public: no such file or directory"

I am trying to build a custom nginx docker image, where I want to overwrite the default.conf file at /etc/nginx/conf.d/default.conf. Following is the code of Dockerfile:

FROM nginx
COPY default.conf /etc/nginx/conf.d/default.conf

But while building the image, I am getting following error:

Sending build context to Docker daemon  3.072kB
Step 1/2 : FROM nginx
# Executing 1 build trigger
COPY failed: stat /var/lib/docker/tmp/docker-builder221277665/public: no such file or directory

As per the logs, it is failing on the first instruction. And it is pointing to the public folder.

Please help me understanding the problem as why it could be pointing to the public folder? Any pointers would be highly appreciated.

Thank you!

Upvotes: 0

Views: 9203

Answers (2)

BMitch
BMitch

Reputation: 265110

As David hinted in the comments, this command looks like it came from an ONBUILD instruction from the base image. Since nginx doesn't ship with that command, this points to another image on the host that was tagged as nginx. Pulling a fresh copy of nginx from upstream can fix that:

docker pull nginx

Upvotes: 3

Christian Sauer
Christian Sauer

Reputation: 10949

Do you have a .dockerignore file which ignores the public folder?

Upvotes: 0

Related Questions