InDockerfileUnder the current directory, when using the build command to build a mirror
docker build --rm -t image-name .
Exception occurred:
ADD failed: stat /var/lib/docker/tmp/docker-builder055888630/install/xxx.zip: no such file or directory
The directory structure is like this:
.
├── Dockerfile
└── install
└── xxx.zip
DockerfileThe content of the document is also relatively simple:
FROM openjdk:8u131-jre-alpine
ADD install/xxx.zip /opt/
...
Beforewindows
There is no problem in executing the ADD command in this way. now switch toUbantu
Only in the past have such problems been discovered. . .
In addition,Docker version 17.09.0-ce
I also checked it on the internet and found similar problems.
Say “add”.dockerignore
File, Command Designation-f
Parameters. . .
All these have been tried, but they are useless. . .
Checked stackoverflow.
Move the answer, there are probably the following solutions
If you want to add/copy, the file must be in the same root directory as the Dockerfile.
Context can be set
version: '3.3' services: yourservice: build: context: ./ dockerfile: ./docker/yourservice/Dockerfile
Mount file