buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

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

Open yyb196 opened this issue 3 years ago • 2 comments

  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

yyb196 avatar Jun 27 '22 09:06 yyb196

This seems related to #1853 :eyes:

jedevc avatar Jun 27 '22 09:06 jedevc

@jedevc not the same situation I'm afraid. issue #1853 could be solved by adding a trailing / to the destination, In my case I already has a trailing slash in destination path.

yyb196 avatar Jun 27 '22 10:06 yyb196