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 fails when cache enabled #596

Closed
mcfedr opened this issue Mar 4, 2019 · 8 comments
Closed

USER command fails when cache enabled #596

mcfedr opened this issue Mar 4, 2019 · 8 comments

Comments

@mcfedr
Copy link
Contributor

mcfedr commented Mar 4, 2019

Actual behavior

USER cmd is failing with error, open /etc/passwd: no such file or directory, looks like the layer isnt getting unpacked to run this command

INFO[0000] Downloading base image eu.gcr.io/my/base/image:latest
INFO[0001] Error while retrieving image from cache: geting file info: stat /cache/sha256:e42ff730b63a982a79bd680817ce3492b85d83577be1c544bfffcb18a9cde539: no such file or directory
INFO[0001] Downloading base image eu.gcr.io/my/base/image:latest
INFO[0003] cmd: USER
error building image: error building stage: open /etc/passwd: no such file or directory

Expected behavior

Works

To Reproduce

Dockerfile:

FROM alpine

USER www-data

Try and build it:

docker run -v $(pwd):/workspace gcr.io/kaniko-project/executor:latest --dockerfile Dockerfile --destination eu.gcr.io/ekreative-internal/kaniko-test --context dir://workspace --cache=true

Work around

Any other task before user causes layer to be unpacked, e.g. RUN echo 1

Related to #508 (comment)

Versions tested:

gcr.io/kaniko-project/executor debug 58ba0d4767a9 6 days ago 46.8MB
gcr.io/kaniko-project/executor latest 025ab64f8cc8 3 weeks ago 45.8MB

@adaniline-traderev
Copy link

The workaround you suggested does not work, as the RUN layer come from the cache:

FROM node:9.4.0-alpine
RUN mkdir -p /app
RUN chown node:node /app
WORKDIR /app
USER node

@mcfedr
Copy link
Contributor Author

mcfedr commented Mar 5, 2019

Yes, you are right, i guess it worked once as i was experimenting,

@dlorenc
Copy link
Collaborator

dlorenc commented Mar 5, 2019

I think this was fixed here: #508

I just sent a PR with a test here: #600

@adaniline-traderev
Copy link

@dlorenc It still does not work with the latest docker image I tried

@mcfedr
Copy link
Contributor Author

mcfedr commented Mar 5, 2019

Unless #508 isnt actually deployed to the latest image, it doesnt fix the issue, but it was merged 2 months ago, so seems unlikely not to be live.

@dlorenc
Copy link
Collaborator

dlorenc commented Mar 7, 2019

Hey,

You're right. I fixed the issue here in #600. I'll get a release out in a day or two, but you can test it from HEAD by building your own image or using:
gcr.io/kaniko-project/executor:9912ccbf8d22bbafbf971124600fbb0b13b9cbd6

@dlorenc dlorenc closed this as completed Mar 7, 2019
@mcfedr
Copy link
Contributor Author

mcfedr commented Mar 15, 2019

Hey,

You're right. I fixed the issue here in #600. I'll get a release out in a day or two, but you can test it from HEAD by building your own image or using:
gcr.io/kaniko-project/executor:9912ccbf8d22bbafbf971124600fbb0b13b9cbd6

I dont like to be this person, but is that new release coming?

@adaniline-traderev
Copy link

It is working for us with gcr.io/kaniko-project/executor:debug-9912ccbf8d22bbafbf971124600fbb0b13b9cbd6

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