-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error messages for non-existing or excluded files #1647
Comments
You could write a pre-validation step that checks |
Also reported in; docker/cli#2690 |
/cc @tiborvass |
Relates to moby/moby#41327 (moby/moby#41327 (comment)) and moby/moby#34986
Docker produces a confusing error message when building a Dockerfile that
ADD
orCOPY
's a file that doesn't exist or is excluded by.dockerignore
.Example 1; when copying from a local source:
Example 2; when copying from a stage or image:
As can be seen in the output above, the error returned to the user includes the physical path inside the tmp dir on the daemon host. These paths should be considered an implementation detail, and provide no value to the user. Printing the tmp
path can confuse users, and will be even more confusing if the daemon is running remotely (or in a VM, such as on Docker Desktop), in which case the path in the error message does not exist on the local machine. I frequently see users being confused by this (paths in Dockerfiles can already be confusing, and sometimes users expect them to be absolute paths on the host, so these error messages make that even more confusing).
BuildKit should produce a more useful error message for these situations;
failed to walk
error, and instead print an error about the actual file (file.txt
) that is attempted to beCOPY
/ADD
-ed/some/non-existing/file.txt
) instead of the physical path (/var/lib/docker/overlay2/....
).dockerignore
(example 1), add a "hint" to the error message that the file may exist but could be excluded by.dockerignore
Opening this ticket to track this enhancement. I haven't looked into the code yet, and may not be able to look at that soon, so whoever wants to work on this, feel free to!
The text was updated successfully, but these errors were encountered: