docker / docker/cli

cli with buildkit will ignore dockerignore's check

Open
#1,938 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/builder area/builder/buildkit
Dominant language
Go
Stars
6.1k
Forks
2.2k
Avg merge
1d 15h
Merged PRs (30d)
43

Description

Description
docker CLI with builkit enabled will ignore .dockerignore file's read errors.

Steps to reproduce the issue:

(MoeLove) ➜  x cat Dockerfile 
FROM scratch

COPY foo foo
COPY bar bar
(MoeLove) ➜  x ls 
bar  Dockerfile  foo
(MoeLove) ➜  x cat Dockerfile 
FROM scratch

COPY foo foo
COPY bar bar
(MoeLove) ➜  x ls -al .dockerignore 
----------. 1 tao tao 4 6月  12 02:10 .dockerignore
(MoeLove) ➜  x cat .dockerignore           
cat: .dockerignore: Permission denied
(MoeLove) ➜  x whoami
tao
(MoeLove) ➜  x docker build --no-cache -t local/ignore .
[+] Building 0.1s (6/6) FINISHED                                                                                 
 => [internal] load .dockerignore                                                                           0.0s
 => => transferring context: 91B                                                                            0.0s
 => [internal] load build definition from Dockerfile                                                        0.0s
 => => transferring dockerfile: 95B                                                                         0.0s
 => [internal] load build context                                                                           0.0s
 => => transferring context: 162B                                                                           0.0s
 => [1/2] COPY foo foo                                                                                      0.0s
 => [2/2] COPY bar bar                                                                                      0.0s
 => exporting to image                                                                                      0.0s
 => => exporting layers                                                                                     0.0s
 => => writing image sha256:5ae5f1e9c56ee852af6a47c0aa4fe78fba3853e720171047617e8b022f06f456                0.0s
 => => naming to docker.io/local/ignore                                                                     0.0s

Describe the results you received:

Build image successfully.

Describe the results you expected:

Build image failed.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

(MoeLove) ➜  x docker version                                                                                    
Client: Docker Engine - Community
 Version:           0.0.0-20190607210243-b93f571b01
 API version:       1.40   
 Go version:        go1.12.5 
 Git commit:        b93f571b01
 Built:             Sat Jun  8 07:31:22 2019
 OS/Arch:           linux/amd64
 Experimental:      true

Output of docker info:

(paste your output here)

Additional environment details (AWS, VirtualBox, physical, etc.):
physical

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 mentioned Dockerfile, unreadable .dockerignore, and docker build command while BuildKit is enabled. Start at the CLI build entry point and trace how the build context reports .dockerignore read errors. Done means the same permission failure causes the build to fail, with a regression test covering it.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.