buildah
buildah copied to clipboard
Match docker behavior for `ADD` and `COPY` with globs if no file matches
Trying to build with this Dockerfile:
from scratch
COPY non[e]xistant .
Describe the results you received:
$ buildah bud
STEP 1/2: FROM scratch
STEP 2/2: COPY non[e]xistant .
Error: building at STEP "COPY non[e]xistant .": checking on sources under "/tmp/u": Rel: can't make relative to /tmp/u; copier: stat: ["/non[e]xistant"]: no such file or directory
Describe the results you expected:
Match current Docker behavior: COPY should not fail if there is not at least one file to copy.
Output of rpm -q buildah or apt list buildah:
buildah-1.37.1-1.fc40.x86_64
Output of buildah version:
Version: 1.37.1
Go Version: go1.22.6
Image Spec: 1.1.0
Runtime Spec: 1.2.0
CNI Spec: 1.1.0
libcni Version:
image Version: 5.33.1
Git Commit:
Built: Thu Aug 15 21:59:01 2024
OS/Arch: linux/amd64
BuildPlatform: linux/amd64
Yeah, this one's a surprise. Note to self: need to check if the docker build behavior depends on whether or not the glob includes wildcards or metacharacters, or if it's just always like that now.
A friendly reminder that this issue had no activity for 30 days.
@nalind What should we do with this one? Is there a difference between docker with and without buildkit?
@rhatdan yes, depending on whether I set DOCKER_BUILDKIT to 0 or 1, this may or may not produce an error:
mkdir /tmp/glob; (echo FROM scratch; echo 'COPY b* .') > /tmp/glob/Dockerfile
docker build /tmp/glob
Since we only want to match BUILDKIT, behavior, I take it Buildkit ignores no match?
I tend to prefer offering an API toggle for the sake of tools that use us as a library. In this case, in my experience, if the source does not include any characters which would be treated as special (e.g., replace b* with b in the above example), an error is still produced.
Hi
I'm having the same problem while trying to copy files that my not exists
A friendly reminder that this issue had no activity for 30 days.
Are there any plans to resolve this?