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

Built image does not contain a layer for USER instruction #1654

Closed
meinenec opened this issue May 19, 2021 · 0 comments · Fixed by #1731
Closed

Built image does not contain a layer for USER instruction #1654

meinenec opened this issue May 19, 2021 · 0 comments · Fixed by #1731

Comments

@meinenec
Copy link

meinenec commented May 19, 2021

Actual behavior
Image built in kaniko does not contain a layer for the USER instruction. The user exists and a whoami shows the container running as the desired user, but there is no layer present when running docker history <image>

Expected behavior
I expect a layer to show the user being set.

To Reproduce
Steps to reproduce the behavior:

  1. build image docker run -v "$PWD":/workspace gcr.io/kaniko-project/executor:v1.6.0 --context dir:///workspace/ --destination image:local --no-push --tarPath=./image.tar
  2. load image docker load -i image.tar
  3. check layers docker history image:local
IMAGE          CREATED         CREATED BY                                      SIZE      COMMENT
<missing>      292 years ago   RUN addgroup -S appgroup && adduser -S testu…   4.68kB
<missing>      5 weeks ago     /bin/sh -c #(nop)  CMD ["/bin/sh"]              0B
<missing>      5 weeks ago     /bin/sh -c #(nop) ADD file:8ec69d882e7f29f06…   5.61MB

Compared to docker

  1. docker build -t image:local .
  2. docker history image:local
IMAGE          CREATED         CREATED BY                                      SIZE      COMMENT
c1fc0aad2f36   9 seconds ago   USER testuser                                   0B        buildkit.dockerfile.v0
<missing>      9 seconds ago   RUN /bin/sh -c addgroup -S appgroup && addus…   4.68kB    buildkit.dockerfile.v0
<missing>      5 weeks ago     /bin/sh -c #(nop)  CMD ["/bin/sh"]              0B
<missing>      5 weeks ago     /bin/sh -c #(nop) ADD file:8ec69d882e7f29f06…   5.61MB

Additional Information
Dockerfile:

FROM alpine:latest

RUN addgroup -S appgroup && adduser -S testuser -G appgroup

USER testuser

Image version:

docker pull gcr.io/kaniko-project/executor:v1.6.0
v1.6.0: Pulling from kaniko-project/executor
Digest: sha256:0fae223f496525e31226cde473ec77ed15abfa8cbabff5ff5bf1c5268355bbb0
Status: Image is up to date for gcr.io/kaniko-project/executor:v1.6.0
gcr.io/kaniko-project/executor:v1.6.0

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
Please check if the build works in docker but not in kaniko
Please check if this error is seen when you use --cache flag
Please check if your dockerfile is a multistage dockerfile
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

Successfully merging a pull request may close this issue.

1 participant