COPY failed: stat /var/lib/docker/tmp/docker-builder780242597/nginx.conf: no such file or directory.
I am building a simple DotnetCore application with docker-compose support with VS2017.
I have two Dockerfile, one for the app and one for an NGINX proxy.
Dotnetcore app Dockerfile https://github.com/avboivin/WssCoreServer/blob/master/server/CoreServer/Dockerfile Nginx Dockerfile https://github.com/avboivin/WssCoreServer/blob/master/server/nginx/Dockerfile docker-compose.yaml https://github.com/avboivin/WssCoreServer/blob/master/server/docker-compose.yml
Expected behavior
The application should build and start.
Actual behavior
I receive an error message stating the copy failed. I have looked online and I see many people having similar issues and solutions which I can't seem to apply to my issue.
Service 'nginx' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder780242597/nginx.conf: no such file or directory.
Information
Docker for windows
Client:
Version: 17.12.0-ce
API version: 1.35
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:05:22 2017
OS/Arch: windows/amd64
Server:
Engine:
Version: 17.12.0-ce
API version: 1.35 (minimum version 1.12)
Go version: go1.9.2
Git commit: c97c6d6
Built: Wed Dec 27 20:12:29 2017
OS/Arch: linux/amd64
Experimental: false
This is my first time writing an issue on github so any criticism is highly welcome.
This is what fixed it for me: https://github.com/docker/for-mac/issues/1922#issuecomment-355364451
It's important for my project to have a different path for the two Dockerfiles, most of the suggestions seem to be moving it to the root file. Is there a way to place the context one step back?
It's important for my project to have a different path for the two Dockerfiles, most of the suggestions seem to be moving it to the root file. Is there a way to place the context one step back?
You may want to keep your context in the same root directory of the root of your project because that's where docker will be looking for the items to copy. Then in order to have your Dockerfile in a separate directory from the context, point docker to the location with -f.
docker build -t test -f ./path/to/docker-files/directory/NameOfYourDockerfile .
Note the . at the end, that keeps the context in your current working directory (pwd) working directory so docker can begin there to copy your items, but -f points docker to the location where it'll find the Dockerfile for instructions.
I have Dockerfile.dev and i have used -f flag as well still i am getting same error
Make sure you are using correct Working directory , which solved this error multiple times for me. if it is .net, place docker file in the folder where your solution file is present (.sln), most of the places in internet placing the docker file a folder above solution file folder. Give a try by placing the file in same folder as .sln and change your working directory to same folder.
Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.
If you have found a problem that seems similar to this, please open a new issue.
Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked