kaniko: error building image: error building stage: failed to execute command: extracting fs from image: removing whiteout .wh.dev: unlinkat //dev/pts/ptmx: operation not permitted

Actual behavior error building image: error building stage: failed to execute command: extracting fs from image: removing whiteout .wh.dev: unlinkat //dev/pts/ptmx: operation not permitted

Expected behavior Build finishes without error.

To Reproduce Steps to reproduce the behavior:

  1. Enable Kaniko and set version:
gcloud config set builds/use_kaniko True
gcloud config set builds/kaniko_image gcr.io/kaniko-project/executor:v0.17.1
  1. Start build:
gcloud builds submit --tag gcr.io/project_id/test_image
  1. Build is finished.
  2. Start build again.
  3. Consistently see the same error message for all subsequent builds.

Additional Information Dockerfile:

FROM nginx:1.17.8-alpine
LABEL name="test_image"
RUN rm -rf /etc/nginx/conf.d/* && rm -rf /usr/share/nginx/html

Kaniko image:

Pulling image: gcr.io/kaniko-project/executor:v0.17.1
v0.17.1: Pulling from kaniko-project/executor
Digest: sha256:565d31516f9bb91763dcf8e23ee161144fd4e27624b257674136c71559ce4493

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
  • - [x]
Please check if this error is seen when you use --cache flag
  • - [x]
Please check if your dockerfile is a multistage dockerfile
  • - [ ]

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

@cvgw the version a1af057 that you linked solved the issue I had,

but - seems to break switching users, the HOME env var is not changed.

This simple docker file illustrates the issue,

FROM alpine
RUN adduser -S -D myuser

RUN echo $HOME
RUN whoami

USER myuser

RUN echo $HOME
RUN whoami

If you run it with latest (or docker build), HOME correctly updates to /home/myuser, with a1af057... it is still /root.

~I’m not able to repro this bug using tag a1af057f997316bfb1c4d2d82719d78481a02a79~

Dockerfile

FROM alpine
RUN adduser -S -D myuser

USER myuser

Docker command

docker run \
  -v $LOCAL_CONTEXT:/workspace
  gcr.io/kaniko-project/executor:a1af057f997316bfb1c4d2d82719d78481a02a79 \
  --context dir:///workspace/ \
  --dockerfile Dockerfile \
  --destination $DESTINATION \
  -v info

Test

$ docker run --rm $DESTINATION /bin/sh -c 'echo $HOME'
=> /home/myuser

~@mcfedr am I missing something from the repo steps or interpreting the test result wrong?~

This is the same problem as #1082 $HOME is not set correctly during the build, but is correct in the final image.

Works fine when I dropped the cache by deleting $DOCKER_IMAGE/cache tags.