moby: AUFS broken permissions?

docker info

Containers: 7
 Running: 0
 Paused: 0
 Stopped: 7
Images: 59
Server Version: 1.10.0
Storage Driver: aufs
 Root Dir: /mnt/sda1/var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 51
 Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
 Volume: local
 Network: bridge null host
Kernel Version: 4.1.17-boot2docker
Operating System: Boot2Docker 1.10.0 (TCL 6.4.1); master : b09ed60 - Thu Feb  4 20:16:08 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 996.2 MiB
Name: pouet2
ID: 6J3W:3S7J:QA6U:2JLY:PEPW:6WNL:4P6N:PWFB:U2XT:KP3S:HDFT:E6QU
Debug mode (server): true
 File Descriptors: 10
 Goroutines: 22
 System Time: 2016-02-11T18:32:54.290248331Z
 EventsListeners: 0
 Init SHA1:
 Init Path: /usr/local/bin/docker
 Docker Root Dir: /mnt/sda1/var/lib/docker
Username: dmp42
Registry: https://index.docker.io/v1/
Labels:
 provider=virtualbox

Dockerfile:

FROM debian:jessie

# Creating test account
RUN adduser --quiet testing

# Copy contrib folder
COPY ./ /home/testing/
RUN chown -R testing:testing /home/testing/

RUN ls -lA /home/testing/contrib

USER testing

RUN ls -lA /home/testing/contrib

To reproduce, be sure to have a contrib folder in the current directory, with at least one subfolder.

Result:

docker build .

Step 5 : RUN ls -lA /home/testing/contrib
 ---> Running in 14b2711f2a50
total 20
drwx------ 2 testing testing 4096 Feb 11 18:31 apache
drwxr-xr-x 2 testing testing 4096 Feb 11 18:31 ceph
drwx------ 4 testing testing 4096 Feb 11 18:31 compose
drwxr-xr-x 4 testing testing 4096 Feb 11 18:31 docker-integration
drwx------ 6 testing testing 4096 Feb 11 18:31 testing
 ---> 4b3a7bdb66d0
Removing intermediate container 14b2711f2a50
Step 6 : USER testing
 ---> Running in c3b0cb5a323e
 ---> c2742d90a5fb
Removing intermediate container c3b0cb5a323e
Step 7 : RUN ls -lA /home/testing/contrib
 ---> Running in 789914bc918e
ls: cannot access /home/testing/contrib/testing: Permission denied
ls: cannot access /home/testing/contrib/compose: Permission denied
ls: cannot access /home/testing/contrib/docker-integration: Permission denied
ls: cannot access /home/testing/contrib/apache: Permission denied
ls: cannot access /home/testing/contrib/ceph: Permission denied
total 0
d????????? ? ? ? ?            ? apache
d????????? ? ? ? ?            ? ceph
d????????? ? ? ? ?            ? compose
d????????? ? ? ? ?            ? docker-integration
d????????? ? ? ? ?            ? testing
The command '/bin/sh -c ls -lA /home/testing/contrib' returned a non-zero code: 1

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (9 by maintainers)

Commits related to this issue

Most upvoted comments

patch has been added to aufs >=4.(x>=1)-20160905

If you have an older aufs version <4.1 because of an older kernel I guess the only option is to apply the patch manually.

https://github.com/sfjro/aufs4-standalone/commit/625634d1dc3e6a0d03fbd918c074912797f5903b#diff-766898e31d29972e93ec410af8228d9a

@otherjason I’ve emailed aufs-users at lists.sourceforge.net hopefully someone will be able to review.

Hi,

I’ve been beaten by this bug few hours ago.

I can confirm the behaviour : get broen permissions (???) until you first “access” the resource as root. As stated by someone else a simple “ls” as root first will fix everything. I’ve actually added the following to my entrypoint logic :

ls -laR /

Env info :

$ sudo docker --version
Docker version 1.11.1, build 5604cbe
$ sudo docker info
Containers: 2
 Running: 2
 Paused: 0
 Stopped: 0
Images: 169
Server Version: 1.11.1
Storage Driver: aufs
 Root Dir: /space/docker/aufs
 Backing Filesystem: extfs
 Dirs: 416
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge null host
Kernel Version: 3.16.0-71-generic
Operating System: Ubuntu 14.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.41 GiB
Name: lp01696
ID: KJ3L:FMBL:L2TX:PR6V:R3KK:OJR3:L4B2:UQEH:TZP4:QICF:KI33:3X53
Docker Root Dir: /space/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
$ uname -a
Linux ------- 3.16.0-71-generic #92~14.04.1-Ubuntu SMP Thu May 12 23:31:46 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:        14.04
Codename:       trusty

Cheers, Francesco

Workaround: Run ls -R /home/testing as root before any other command.