Skip to content

docker build throws an error if a file anywhere in the build context tree can't be read by the current user, even if that file has nothing to do with the build. #34711

@paul-tcell

Description

@paul-tcell

Description

docker build throws an error if there is a file unreadable by the current user in the build context directory or any subdirectory of the context dir. Even if the file is unused by the build itself.

Appears related to #6521.

Steps to reproduce the issue:
In some temp directory, create a Dockerfile
e.g

FROM alpine
CMD echo "hello"

in that dir, also create an unreadable file
e.g

touch file_that_has_nothing_to_do_with_build.log
sudo chown root:root file_that_has_nothing_to_do_with_build.log
sudo chmod 0600 file_that_has_nothing_to_do_with_build.log

run docker build:
docker build -t foo .

Describe the results you received:
error checking context: 'no permission to read from '/tmp/docker_error/file_that_has_nothing_to_do_with_build.log''.

Describe the results you expected:
docker building the image.

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

Output of docker version:

Client:
 Version:      17.06.1-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   874a737
 Built:        Thu Aug 17 22:51:12 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.06.1-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   874a737
 Built:        Thu Aug 17 22:50:04 2017
 OS/Arch:      linux/amd64
 Experimental: false

Output of docker info:

Containers: 16
 Running: 1
 Paused: 0
 Stopped: 15
Images: 113
Server Version: 17.06.1-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 200
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.10.0-32-generic
Operating System: Linux Mint 18.2
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 31.31GiB
Name: minty
ID: JYRK:VELJ:H2CK:NMO3:A24S:FUCJ:MVCL:L34I:3CA6:BMDV:DTAY:RQ4Q
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: ********
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions