Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker container output files owned by root instead of non-privileged user #125

Open
cvoltz opened this issue May 10, 2019 · 6 comments
Open

Comments

@cvoltz
Copy link

cvoltz commented May 10, 2019

Problem Description

Using the Docker container to create the reports results in the output being owned by root rather than the user running the container (or at least some other non-root user).

Steps to Reproduce

From the directory with your Cucumber .json result file, run:

docker run \
  --rm \
  --volume "$PWD:/output" \
  rmpestano/cukedoctor \
    -f html \
    -o /output/documentation \
    -t "My Project" \
    -toc left
ls -lR

Expected Output

.:
total 768
-rw-rw-r--. 1 cvoltz cvoltz 343084 May 10 17:12 acceptance-tests.json
-rw-r--r--. 1 cvoltz cvoltz 119998 May 10 17:30 documentation.adoc
-rw-rw-rw-. 1 cvoltz cvoltz 297731 May 10 17:30 documentation.html
drwxr-xr-x. 2 cvoltz cvoltz   4096 May 10 17:30 themes

./themes:
total 372
-rw-r--r--. 1 cvoltz cvoltz 29610 May 10 17:30 asciidoctor.css
-rw-r--r--. 1 cvoltz cvoltz 36715 May 10 17:30 colony.css
-rw-r--r--. 1 cvoltz cvoltz 36217 May 10 17:30 foundation.css
-rw-r--r--. 1 cvoltz cvoltz 37988 May 10 17:30 github.css
-rw-r--r--. 1 cvoltz cvoltz 38305 May 10 17:30 iconic.css
-rw-r--r--. 1 cvoltz cvoltz 36287 May 10 17:30 maker.css
-rw-r--r--. 1 cvoltz cvoltz 37391 May 10 17:30 readthedocs.css
-rw-r--r--. 1 cvoltz cvoltz 36970 May 10 17:30 rocket-panda.css
-rw-r--r--. 1 cvoltz cvoltz 35460 May 10 17:30 rubygems.css

Given $USER was cvoltz.

Actual Output

.:
total 760
-rw-rw-r--. 1 cvoltz cvoltz 343084 May 10 17:12 acceptance-tests.json
-rw-r--r--. 1 root   root   119998 May 10 17:30 documentation.adoc
-rw-rw-rw-. 1 root   root   297731 May 10 17:30 documentation.html
drwxr-xr-x. 2 root   root     4096 May 10 17:30 themes

./themes:
total 336
-rw-r--r--. 1 root root 29610 May 10 17:30 asciidoctor.css
-rw-r--r--. 1 root root 36715 May 10 17:30 colony.css
-rw-r--r--. 1 root root 36217 May 10 17:30 foundation.css
-rw-r--r--. 1 root root 37988 May 10 17:30 github.css
-rw-r--r--. 1 root root 38305 May 10 17:30 iconic.css
-rw-r--r--. 1 root root 36287 May 10 17:30 maker.css
-rw-r--r--. 1 root root 37391 May 10 17:30 readthedocs.css
-rw-r--r--. 1 root root 36970 May 10 17:30 rocket-panda.css
-rw-r--r--. 1 root root 35460 May 10 17:30 rubygems.css
@rmpestano
Copy link
Owner

Hi, thanks for the feedback @cvoltz

Do you have sometime to have a look @ralphavalon?

thank you guys

@ralphavalon
Copy link

Thanks for the feedback. I'll look this =)

@ralphavalon
Copy link

ralphavalon commented Aug 25, 2019

To be honest, I could not reproduce this problem. Can you give me more information?

When I run whoami , I get my current user: raphael.amoedo

When I run ls -lrth on my current location (which is cukedoctor-main path - this project), I got this:

total 48
-rw-r--r--   1 raphael.amoedo  staff    11K Dec 30  2018 LICENSE
drwxr-xr-x   4 raphael.amoedo  staff   128B Dec 30  2018 src
-rw-r--r--@  1 raphael.amoedo  staff   4.4K Jan  1  2019 pom.xml
drwxr-xr-x  17 raphael.amoedo  staff   544B Jan  1  2019 target
drwxr-xr-x   3 raphael.amoedo  staff    96B Aug 25 14:47 docker
-rw-r--r--   1 raphael.amoedo  staff   382B Aug 25 15:17 Dockerfile

When I run:

docker run \
  --rm \
  --volume "$PWD:/output" \
  rmpestano/cukedoctor \
    -f html \
    -o /output/generated_doc/documentation \
    -t "My Project" \
    -toc left
ls -lR generated_doc

That's the result:

total 184
-rw-r--r--   1 raphael.amoedo  staff   7233 Aug 25 15:27 documentation.adoc
-rw-rw-rw-   1 raphael.amoedo  staff  84003 Aug 25 15:27 documentation.html
drwxr-xr-x  11 raphael.amoedo  staff    352 Aug 25 15:27 themes

generated_doc/themes:
total 672
-rw-r--r--  1 raphael.amoedo  staff  29610 Aug 25 15:27 asciidoctor.css
-rw-r--r--  1 raphael.amoedo  staff  36715 Aug 25 15:27 colony.css
-rw-r--r--  1 raphael.amoedo  staff  36217 Aug 25 15:27 foundation.css
-rw-r--r--  1 raphael.amoedo  staff  37988 Aug 25 15:27 github.css
-rw-r--r--  1 raphael.amoedo  staff  38305 Aug 25 15:27 iconic.css
-rw-r--r--  1 raphael.amoedo  staff  36287 Aug 25 15:27 maker.css
-rw-r--r--  1 raphael.amoedo  staff  37391 Aug 25 15:27 readthedocs.css
-rw-r--r--  1 raphael.amoedo  staff  36970 Aug 25 15:27 rocket-panda.css
-rw-r--r--  1 raphael.amoedo  staff  35460 Aug 25 15:27 rubygems.css

@cvoltz
Copy link
Author

cvoltz commented Sep 30, 2019

I tried with your repo just to see if it made a difference but it didn't.

git clone https://github.com/rmpestano/cukedoctor.git
cd cukedoctor
docker run \
   --rm \
   --volume "$PWD:/output" \
   rmpestano/cukedoctor \
   -f html \
   -o /output/generated_doc/documentation \
   -t "My Project" \
   -toc left
$ ls -l
total 128
drwxrwxr-x. 3 cvoltz cvoltz  4096 Sep 30 13:51 cukedoctor-converter
drwxrwxr-x. 3 cvoltz cvoltz  4096 Sep 30 13:51 cukedoctor-extension
drwxrwxr-x. 4 cvoltz cvoltz  4096 Sep 30 13:51 cukedoctor-main
drwxrwxr-x. 3 cvoltz cvoltz  4096 Sep 30 13:51 cukedoctor-maven-plugin
drwxrwxr-x. 3 cvoltz cvoltz  4096 Sep 30 13:51 cukedoctor-spi-example
drwxr-xr-x. 3 root   root    4096 Sep 30 13:52 generated_doc
-rw-rw-r--. 1 cvoltz cvoltz 32121 Sep 30 13:51 html2text.py
drwxrwxr-x. 2 cvoltz cvoltz  4096 Sep 30 13:51 img
-rw-rw-r--. 1 cvoltz cvoltz 11358 Sep 30 13:51 LICENSE
-rw-rw-r--. 1 cvoltz cvoltz 14441 Sep 30 13:51 pom.xml
-rwxrwxr-x. 1 cvoltz cvoltz 30027 Sep 30 13:51 README.adoc
-rw-rw-r--. 1 cvoltz cvoltz   610 Sep 30 13:51 release_process.txt
-rw-rw-r--. 1 cvoltz cvoltz   632 Sep 30 13:51 settings.xml
                                                                                                                         
$ ls -l generated_doc/
total 336
-rw-r--r--. 1 root root  59058 Sep 30 13:52 documentation.adoc
-rw-rw-rw-. 1 root root 276103 Sep 30 13:52 documentation.html
drwxr-xr-x. 2 root root   4096 Sep 30 13:52 themes

$ whoami
cvoltz

Here is some more information on my Fedora 30 system which repros the problem:

$ lsb_release --all
LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 30 (Thirty)
Release:        30
Codename:       Thirty

$ rpm -qi docker-ce-cli
Name        : docker-ce-cli
Epoch       : 1
Version     : 19.03.2
Release     : 3.fc30
Architecture: x86_64
Install Date: Wed 04 Sep 2019 10:44:50 PM CDT
Group       : Tools/Docker
Size        : 176755735
License     : ASL 2.0
Signature   : RSA/SHA512, Tue 03 Sep 2019 01:37:45 PM CDT, Key ID c52feb6b621e9f35
Source RPM  : docker-ce-cli-19.03.2-3.fc30.src.rpm
Build Date  : Thu 29 Aug 2019 12:29:22 AM CDT
Build Host  : 417612f80095
Relocations : (not relocatable)
Packager    : Docker <[email protected]>
Vendor      : Docker
URL         : https://www.docker.com
Summary     : The open-source application container engine
...

$ docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 1
 Server Version: 19.03.2
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 894b81a4b802e4eb2a91d1ce216b8817763c29fb
 runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.2.17-200.fc30.x86_64
 Operating System: Fedora 30 (Workstation Edition)
 OSType: linux
 Architecture: x86_64
 CPUs: 8
 Total Memory: 31.33GiB
 Name: cv-laptop.localdomain
 ID: 2DDO:EFHS:RAK4:QHV6:L4AB:7SEN:5ROY:XPRW:SRB7:WG6V:6ZRW:TMQZ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

$ ps ax | grep docker
 4243 ?        Ssl    0:16 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

@rmpestano
Copy link
Owner

Hi guys, same thing here, generated_docs is owned by root user:

Screenshot from 2019-09-30 16-34-02
Screenshot from 2019-09-30 16-32-34

@cvoltz
Copy link
Author

cvoltz commented Sep 30, 2019

Good to see it isn't just me. 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants