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

USER command set wrong $HOME or gid #507

Closed
qwazerty opened this issue Jan 4, 2019 · 1 comment · Fixed by #995
Closed

USER command set wrong $HOME or gid #507

qwazerty opened this issue Jan 4, 2019 · 1 comment · Fixed by #995
Assignees
Labels
area/dockerfile-command For all bugs related to dockerfile file commands in progress priority/p1 Basic need feature compatibility with docker build. we should be working on this next.

Comments

@qwazerty
Copy link

qwazerty commented Jan 4, 2019

Actual behavior
Switching to a different user does not do the same behavior on $HOME and gid as the native docker build commands.

Expected behavior
When using USER runner, the gid and groups should be set to uid=1000(runner) gid=1000(runner) groups=1000(runner).
When using USER runner:runner the $HOME should be set to /home/runner.

To Reproduce
Using this Dockerfile produce the following output.

FROM ubuntu:latest

RUN useradd -m -s /bin/bash runner
USER runner
RUN echo $HOME; id
USER runner:runner
RUN echo $HOME; id

With kaniko (keeping just enough log)

$ /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination repository.../$CI_PROJECT_NAME:latest
INFO[0000] Downloading base image ubuntu:latest
INFO[0005] RUN useradd -m -s /bin/bash runner
INFO[0005] USER runner
INFO[0005] RUN echo $HOME; id
/home/runner
uid=1000(runner) gid=0(root) groups=0(root)        <-- Wrong gid and groups
INFO[0006] USER runner:runner
INFO[0006] RUN echo $HOME; id
/                                                  <-- Wrong $HOME
uid=1000(runner) gid=1000(runner) groups=1000(runner)

With docker build.

Step 1/6 : FROM ubuntu:latest
latest: Pulling from library/ubuntu
Step 2/6 : RUN useradd -m -s /bin/bash runner
Step 3/6 : USER runner
Step 4/6 : RUN echo $HOME; id
/home/runner
uid=1000(runner) gid=1000(runner) groups=1000(runner)
Step 5/6 : USER runner:runner
Step 6/6 : RUN echo $HOME; id
/home/runner
uid=1000(runner) gid=1000(runner) groups=1000(runner)
@qwazerty qwazerty changed the title USER $HOME and id incorrect USER command set wrong $HOME and gid Jan 4, 2019
@qwazerty qwazerty changed the title USER command set wrong $HOME and gid USER command set wrong $HOME or gid Jan 4, 2019
@donmccasland donmccasland added area/dockerfile-command For all bugs related to dockerfile file commands priority/p1 Basic need feature compatibility with docker build. we should be working on this next. labels Sep 20, 2019
@cvgw cvgw added this to the GA Release v1.0.0 milestone Jan 10, 2020
@cvgw
Copy link
Contributor

cvgw commented Jan 10, 2020

I imagine this issue is related to #822

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dockerfile-command For all bugs related to dockerfile file commands in progress priority/p1 Basic need feature compatibility with docker build. we should be working on this next.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants