Skip to content
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

COPY with glob is incompatible with Docker #3069

Closed
jimsnab opened this issue Mar 14, 2024 · 6 comments · Fixed by #3127
Closed

COPY with glob is incompatible with Docker #3069

jimsnab opened this issue Mar 14, 2024 · 6 comments · Fixed by #3127
Labels
area/dockerfile-command For all bugs related to dockerfile file commands cmd/copy differs-from-docker kind/bug Something isn't working priority/p0 Highest priority. Break user flow. We are actively looking at delivering it. priority/p1 Basic need feature compatibility with docker build. we should be working on this next. works-with-docker

Comments

@jimsnab
Copy link

jimsnab commented Mar 14, 2024

Actual behavior

Given
COPY file_that_might_not_exis[t] /dest

Kaniko returns this error when the file does not exist

failed to get files used from context: copy failed: no source files specified

Expected behavior

Match current Docker behavior - when glob is used, COPY does not need to copy at least one file.

To Reproduce

  1. Try simple dockerfile

Additional Information

  • Dockerfile
FROM alpine
COPY known_host[s] /etc/ssh/ssh_known_hosts
  • Build Context

Don't make the known_hosts file.

  • Kaniko Image (fully qualified with digest)

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
  • - [No]
Please check if the build works in docker but not in kaniko
  • - [Yes]
Please check if this error is seen when you use --cache flag
  • - [Yes]
Please check if your dockerfile is a multistage dockerfile
  • - [Yes]
@aaron-prindle aaron-prindle added differs-from-docker works-with-docker priority/p1 Basic need feature compatibility with docker build. we should be working on this next. priority/p0 Highest priority. Break user flow. We are actively looking at delivering it. cmd/copy area/dockerfile-command For all bugs related to dockerfile file commands kind/bug Something isn't working labels Mar 14, 2024
@prima101112
Copy link
Contributor

Hi @jimsnab could you confirm, is this error only happen when there is no files, or even there is a file, is not detected the glob pattern? and if there is files is it copying all match pattern?

@yossicohn
Copy link

@prima101112 I got many of my Dockerfiles not building because of this regression...very painful one

@yossicohn-hs
Copy link

@aaron-prindle @prima101112 any work around for this one?

@jimsnab
Copy link
Author

jimsnab commented Apr 4, 2024

Hi @jimsnab could you confirm, is this error only happen when there is no files, or even there is a file, is not detected the glob pattern? and if there is files is it copying all match pattern?

Error is when there is no file (which is the reason to use this pattern).

@prima101112
Copy link
Contributor

@yossicohn @jimsnab hope this will works we checked if using wildcard and file not found it will return error , change to warn instead

@yossicohn
Copy link

yossicohn commented Apr 28, 2024

@prima101112 Thanks, I don't think it is the same as #3092.
Since there I show that the file exist but COPY will fail even though the files exist.
This failure occurs in the following cases of COPY usage

COPY . .
or
COPY ./* ./
or
COPY ./*.json ./

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dockerfile-command For all bugs related to dockerfile file commands cmd/copy differs-from-docker kind/bug Something isn't working priority/p0 Highest priority. Break user flow. We are actively looking at delivering it. priority/p1 Basic need feature compatibility with docker build. we should be working on this next. works-with-docker
Projects
None yet
5 participants