Open markusheiden opened 1 year ago
We have a similar issue when using "gcr.io/kaniko-project/executor:debug"
for
FROM summerwind/actions-runner:ubuntu-22.04
USER runner
WORKDIR /usr/app
RUN curl -sL https://deb.nodesource.com/setup_18.x | sudo bash -
RUN sudo apt-get install -y nodejs && sudo npm install --global yarn
with the error
gcr.io/kaniko-project/executor:debug
�[36mINFO�[0m[0001] Retrieving image manifest summerwind/actions-runner:ubuntu-22.04
�[36mINFO�[0m[0001] Retrieving image summerwind/actions-runner:ubuntu-22.04 from registry index.docker.io
�[36mINFO�[0m[0002] Retrieving image manifest summerwind/actions-runner:ubuntu-22.04
�[36mINFO�[0m[0002] Returning cached image manifest
�[36mINFO�[0m[0002] Built cross stage deps: map[]
�[36mINFO�[0m[0002] Retrieving image manifest summerwind/actions-runner:ubuntu-22.04
�[36mINFO�[0m[0002] Returning cached image manifest
�[36mINFO�[0m[0002] Retrieving image manifest summerwind/actions-runner:ubuntu-22.04
�[36mINFO�[0m[0002] Returning cached image manifest
�[36mINFO�[0m[0002] Executing 0 build triggers
�[36mINFO�[0m[0002] Building stage 'summerwind/actions-runner:ubuntu-22.04' [idx: '0', base-idx: '-1']
�[36mINFO�[0m[0002] Cmd: USER
�[36mINFO�[0m[0002] Checking for cached layer europe-west2-docker.pkg.dev/repo/company-docker/company-actions-runner/cache:705e862785460a518a3b63f325e3126740b12b7.....
�[36mINFO�[0m[0004] Using caching version of cmd: RUN curl -sL https://deb.nodesource.com/setup_18.x | sudo bash -
�[36mINFO�[0m[0004] Checking for cached layer europe-west2-docker.pkg.devrepo/company-docker/company-actions-runner/cache:230c5b845fbb72af1b1222ba711ea2ab5c......
�[36mINFO�[0m[0006] Using caching version of cmd: RUN sudo apt-get install -y nodejs && sudo npm install --global yarn
�[36mINFO�[0m[0006] Skipping unpacking as no commands require it.
�[36mINFO�[0m[0006] USER runner
�[36mINFO�[0m[0006] Cmd: USER
�[36mINFO�[0m[0006] No files changed in this command, skipping snapshotting.
�[36mINFO�[0m[0006] WORKDIR /usr/app
�[36mINFO�[0m[0006] Cmd: workdir
�[36mINFO�[0m[0006] Changed working directory to /usr/app
error building image: error building stage: failed to execute command: identifying uid and gid for user runner: user runner is not a uid and does not exist on the system
ERROR
ERROR: build step 0 "gcr.io/kaniko-project/executor:debug" failed: step exited with non-zero status: 1
might be related to #2384 and #2440 which bumped the go-containerregistry dependency by multiple minor versions between 1.9.1 and 1.9.2.
I tested with 1.13.0 today and the problem seems to be fixed.
Thanks for the update @markusheiden! Going to close this as it appears to be fixed now
@aaron-prindle; I've just hit this same issue in 1.13.0. It seems not to happen when there is no cache available, but happens when cache is available. I've hit this a few times. Downgrading to 1.9.1 fixes the issue. I think this should be re-opened.
I'm seeing this issue as well with 1.16.0, here are my steps to reproduce.
Without WORKDIR /app
the build works. This same build works with docker.
These same steps with v1.9.1-debug result in a successful build.
$ docker run -it --rm --entrypoint sh gcr.io/kaniko-project/executor:v1.16.0-debug
/workspace # touch foo
/workspace # echo -e "FROM ubuntu:latest\nUSER test\nWORKDIR /app\nCOPY foo ." >Dockerfile
/workspace # /kaniko/executor --context $PWD --dockerfile Dockerfile --no-push
INFO[0000] Retrieving image manifest ubuntu:latest
INFO[0000] Retrieving image ubuntu:latest from registry index.docker.io
INFO[0000] Built cross stage deps: map[]
INFO[0000] Retrieving image manifest ubuntu:latest
INFO[0000] Returning cached image manifest
INFO[0000] Executing 0 build triggers
INFO[0000] Building stage 'ubuntu:latest' [idx: '0', base-idx: '-1']
INFO[0000] Unpacking rootfs as cmd COPY foo . requires it.
INFO[0002] USER test
INFO[0002] Cmd: USER
INFO[0002] WORKDIR /app
INFO[0002] Cmd: workdir
INFO[0002] Changed working directory to /app
error building image: error building stage: failed to execute command: identifying uid and gid for user test: user test is not a uid and does not exist on the system
I experience the same bug on Kaniko 1.19.2:
Kaniko's version I use: executor: gcr.io/kaniko-project/executor:v1.19.2
.
The Kaniko error logs from the Github Actions dashboard looks like this:
[36mINFO[0m[0087] WORKDIR ${APP_DIR}
[36mINFO[0m[0087] Cmd: workdir
[36mINFO[0m[0087] Changed working directory to /home/poetryuser/falco-mitre-checker
[37mDEBU[0m[0087] Fetching uid and gid for USER 'poetryuser'
error building image: error building stage: failed to execute command: identifying uid and gid for user poetryuser: user poetryuser is not a uid and does not exist on the system
##[error]Error: The process '/usr/bin/docker' failed with exit code 1
Link to my CI pipeline on Github: https://github.com/ThalesGroup/rules/actions/runs/7557411837/job/20576570525
My Containerfile looks like this:
[...]
# create a non-root user since this app does not need root privileges
RUN addgroup \
--gid ${APP_GROUP_GID} \
${APP_GROUP} \
&& adduser \
--uid ${APP_USER_UID} \
--gid ${APP_GROUP_GID} \
--shell /bin/bash \
--disabled-login \
--disabled-password \
--gecos "User for poetry app" \
${APP_USER}
[...]
# PROJECT_DIR and APP_DIR are defined above
ARG APP_DIR
ARG APP_USER
# use non-root user
USER ${APP_USER}
WORKDIR ${APP_DIR}
ENTRYPOINT [ "python", "-m", "falco_mitre_checker"]
[...]
It is worth mentioning that when I build the same Containerfile
with podman build
, I have no problem: the container build is a success and the container image works fine.
Is there any workaround or ECD on this issue? As it stands, I'm stuck using v1.9.1.
Also ran into this bug, but we're unable to downgrade to 1.9.1.
Can confirm it's related to building the container while a Cache is available. Disabling the cache allows the build to run.
Running into same issue. Any ETA for the fix? Any workaround?
Actual behavior When migrating from 1.9.1 to 1.9.2 (gcr.io/kaniko-project/executor:v1.9.2-debug) I get issues with USER:
error building image: error building stage: failed to execute command: identifying uid and gid for user cloudsdk: user cloudsdk is not a uid and does not exist on the system
The issue happens with 1.10.0 too.
Expected behavior No error.
To Reproduce Build this Dockerfile with Kaniko:
--cache
flagWithout the
--cache
option, the error still happens.Full log: