moby / moby/buildkit

[compatible issue]buildkit COPY command doesn't match to docker's

Open
#2,933 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/feature-parity
Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 23h
Merged PRs (30d)
48

Description

  1. I have a directory only has one Dockerfile, its content is:
#cat Dockerfile
FROM alpine
COPY folder/a/* folder/b/* /home/admin/
  1. using docker build command, it will fail
#DOCKER_BUILDKIT=0 docker build -t test .
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM alpine
 ---> e66264b98777
Step 2/2 : COPY folder/a/* folder/b/* /home/admin/
COPY failed: no source files were specified
  1. after I make folder/a and its sub directory, it build success without specified folder/b
#mkdir -p folder/a/sub_a

#DOCKER_BUILDKIT=0 docker build -t test .
Sending build context to Docker daemon  3.584kB
Step 1/2 : FROM alpine
 ---> e66264b98777
Step 2/2 : COPY folder/a/* folder/b/* /home/admin/
 ---> 0c7538017880
Successfully built 0c7538017880
Successfully tagged test:latest
  1. but in same directory, buildkit fails to build
#DOCKER_BUILDKIT=1 docker build -t test .
[+] Building 0.1s (6/6) FINISHED                                                                                                                                                                
 => [internal] load build definition from Dockerfile                                                                                                                                       0.0s
 => => transferring dockerfile: 89B                                                                                                                                                        0.0s
 => [internal] load .dockerignore                                                                                                                                                          0.0s
 => => transferring context: 2B                                                                                                                                                            0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                           0.0s
 => [internal] load build context                                                                                                                                                          0.0s
 => => transferring context: 90B                                                                                                                                                           0.0s
 => CACHED [1/2] FROM docker.io/library/alpine                                                                                                                                             0.0s
 => ERROR [2/2] COPY folder/a/* folder/b/* /home/admin/                                                                                                                                    0.1s
------
 > [2/2] COPY folder/a/* folder/b/* /home/admin/:
------
lstat /var/lib/docker/tmp/buildkit-mount1810022841/folder/b: no such file or directory

docker version 20.10.16, with builtin buildkit

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the shown Dockerfile and compare DOCKER_BUILDKIT=0 and DOCKER_BUILDKIT=1 using the same build context. Trace BuildKit's COPY wildcard handling for a missing folder/b path. Done means the BuildKit result matches Docker's behavior for this context, with regression coverage for the command shown.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.