0

I have a strange issue here, where I don't see the point what it is going wrong.

I am running everything in a docker container on my Linux box (Ubuntu 16.04 LTS):

docker run -ti --rm promregator/promregator:0.2.1 /bin/bash

(note: the image is available publicly via hub.docker.com). The command

docker version

(on the host) returns

Client:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Wed Oct 26 22:01:48 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Wed Oct 26 22:01:48 2016
 OS/Arch:      linux/amd64

In the container, I want to create a file like this:

promregator@6a68713fafc9:/$ cd /opt/promregator
promregator@6a68713fafc9:/opt/promregator$ touch test
touch: cannot touch 'test': Permission denied

(promregator is the user, with which the image runs as default). Note that

  • The directory is coming directly from the image and is not volume-mapped.
  • The directory is owned by the very same user and the permissions are 0750:

    promregator@6a68713fafc9:/opt/promregator$ ls -al
    total 34348
    drwxr-x--- 2 promregator promregator     4096 Apr  1 01:00 .
    drwxr-xr-x 5 root        root            4096 Mar 20 01:01 ..
    -rw-r----- 1 promregator promregator 35159385 Apr  1 00:59 promregator.jar
    -rwxrwx--- 1 promregator promregator      642 Apr  1 00:57 promregator.sh
    

    Numerically, the user is 1000

    promregator@6a68713fafc9:/opt/promregator$ ls -aln .
    total 34348
    drwxr-x--- 2 1000 1000     4096 Apr  1 01:00 .
    [...]
    

Note also, that the very same operation works on /home/promregator:

promregator@6a68713fafc9:/opt/promregator$ cd /home/promregator
promregator@6a68713fafc9:~$ touch test
promregator@6a68713fafc9:~$ ls -al .
total 8
drwx------ 2 promregator promregator 4096 Apr  7 11:45 .
drwxr-xr-x 4 root        root        4096 Apr  7 11:45 ..
-rw-r--r-- 1 promregator promregator    0 Apr  7 11:45 test
promregator@6a68713fafc9:~$ ls -aln .
total 8
drwx------ 2 1000 1000 4096 Apr  7 11:45 .
drwxr-xr-x 3    0    0 4096 Apr  7 11:45 ..
-rw-r--r-- 1 1000 1000    0 Apr  7 11:45 test

Note that, if I run the container as root by using

docker run -ti --rm -u root promregator/promregator:0.2.1 /bin/bash

I am able to create the file in the first location:

root@eb29fa8acb95:/# cd /opt/promregator/
root@eb29fa8acb95:/opt/promregator# touch test

This tells me that there is something "strange" with the user promregator.

On a different host (I have compared the sha1 ids of the images), the file can be created as expected, if the container was started with docker run -ti --rm promregator/promregator:0.2.1 /bin/bash. The version information of that host indicates

Client:
 Version:       17.12.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    c97c6d6
 Built: Wed Dec 27 20:11:19 2017
 OS/Arch:       linux/amd64

Server:
 Engine:
  Version:      17.12.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   c97c6d6
  Built:        Wed Dec 27 20:09:54 2017
  OS/Arch:      linux/amd64
  Experimental: false

Any ideas, hints, ... for me, what this could be?

Thanks in advance!

0

I met the same problem today. My solution is to turn off selinux by "setenforce 0".

  • You have a source for that? – Tiago Caldeira May 25 '18 at 9:00
  • Where did you do this? On the docker host or during building the mage? – EagleRainbow May 26 '18 at 9:49

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.