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

Cannot change user group id, restart again and again #1

Closed
chenzilin opened this issue Jun 3, 2020 · 4 comments
Closed

Cannot change user group id, restart again and again #1

chenzilin opened this issue Jun 3, 2020 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@chenzilin
Copy link

FROM accetto/xubuntu-vnc-novnc:lab-ubuntu18.04.4

$ cat ubuntu-xfce4-dev-docker_chenzilin.sh
#!/bin/bash
sudo docker run -d
-p 14901:22
-p 15901:5901
-p 16901:6901
--user 1000:1000
--restart=always
--name ubuntu-xfce4-dev-docker_chenzilin
ubuntu-xfce4-dev-docker:v3.0

$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
398b336c7714 ubuntu-xfce4-dev-docker:v3.0 "/tini -- /dockersta…" 3 minutes ago Restarting (1) 56 seconds ago ubuntu-xfce4-dev-docker_chenzilin

$ sudo docker logs 398b336c7714
cp: cannot create regular file '/etc/passwd': Permission denied
cp: cannot create regular file '/etc/passwd': Permission denied
cp: cannot create regular file '/etc/passwd': Permission denied
cp: cannot create regular file '/etc/passwd': Permission denied
cp: cannot create regular file '/etc/passwd': Permission denied
cp: cannot create regular file '/etc/passwd': Permission denied
cp: cannot create regular file '/etc/passwd': Permission denied
cp: cannot create regular file '/etc/passwd': Permission denied

when use --user 1000, it's OK
when use --user 1000:1000, restart again and again

@accetto
Copy link
Owner

accetto commented Jun 3, 2020

Hello,
I want to confirm the question. I'll check it. However, I cannot promise that it'll be this week, because I'm pretty busy elsewhere, but I'll try.
Regards, accetto

@accetto accetto self-assigned this Jun 3, 2020
@chenzilin
Copy link
Author

chenzilin commented Jun 5, 2020

at your convenience

this project is so great and wonderful.

my sincerely gratitude!

@accetto accetto added the bug Something isn't working label Jun 6, 2020
@accetto
Copy link
Owner

accetto commented Jun 6, 2020

It's corrected in the release 20.06.
Thanks for the question, it has helped to fix an old bug. :)
Regards, accetto

@accetto accetto closed this as completed Jun 6, 2020
@accetto
Copy link
Owner

accetto commented Jun 7, 2020

This is how you can test that it's working.

First you can pull the lab variation of the image:

docker pull accetto/xubuntu-vnc-novnc:lab-ubuntu18.04.4

You can rename it, for example, to chenzilin/cubuntu-xfce4-dev-docker:v3.0:

docker tag accetto/xubuntu-vnc-novnc:lab-ubuntu18.04.4 chenzilin/cubuntu-xfce4-dev-docker:v3.0

Then you can run you script, which will start the container ubuntu-xfce4-dev-docker_chenzilin in the background:

$ cat ubuntu-xfce4-dev-docker_chenzilin.sh \
#!/bin/bash
docker run -d \
-p 14901:22 \
-p 15901:5901 \
-p 16901:6901 \
--user 1000:1000 \
--restart=always \
--name ubuntu-xfce4-dev-docker_chenzilin \
chenzilin/cubuntu-xfce4-dev-docker:v3.0

After checking that it's still running by using

docker ps -a

you can connect to it interactively

docker exec -it ubuntu-xfce4-dev-docker_chenzilin bash

and check the user and group IDs (note that the instance ID in the prompt will be different each time)

headless@456ef013eda3:~$ id
uid=1000(headless) gid=1000(headless) groups=1000(headless)
headless@456ef013eda3:~$ exit

There is also a simpler way, if you only want to check the user and group IDs. You can use a temporary container which will be automatically removed:

cat ubuntu-xfce4-dev-docker_chenzilin.sh \
#!/bin/bash
docker run -it \
--user 1000:1000 \
--rm \
--name just_test \
chenzilin/cubuntu-xfce4-dev-docker:v3.0 --skip id

You should get the following output:

Skip VNC startup
Executing command: 'id'
uid=1000(headless) gid=1000(headless) groups=1000(headless)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants