kaniko: Kaniko builds fail in Cloud Build without `--additional-whitelist=/var/run`
Actual behavior Kaniko builds fail in Cloud Build, in standard configuration.
Expected behavior
Kaniko builds work just fine, without the extra --additional-whitelist=/var/run flag.
To Reproduce Steps to reproduce the behavior:
- Configure a Cloud Build job in standard debug configuration:
steps:
- name: gcr.io/kaniko-project/executor:debug
args: ["--dockerfile=<path to Dockerfile within the build context>",
"--context=dir://<path to build context>",
"--destination=<gcr.io/$PROJECT/$IMAGE:$TAG>"]
- Observe that the build fails with
error building image: error building stage: failed to get filesystem from image: error removing var/run to make way for new symlink: unlinkat /var/run/docker.sock: device or resource busy
- Add
--additional-whitelist=/var/runto the build step, and it succeeds.
Additional Information Any Dockerfile (unverified).
Triage Notes for the Maintainers
Initially reported in https://github.com/GoogleContainerTools/kaniko/issues/903#issuecomment-578362533
| 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 |
|
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 30
- Comments: 36 (14 by maintainers)
Commits related to this issue
- fix(cloudbuild): Pin Kaniko to 0.16.0 as 0.17.0 breaks GCB See GoogleContainerTools/kaniko#1001 — committed to getsentry/sentry by BYK 4 years ago
- fix(cloudbuild): Pin Kaniko to 0.17.1 as 0.17.0 breaks GCB (#16803) See GoogleContainerTools/kaniko#1001 — committed to getsentry/sentry by BYK 4 years ago
- whitelisting /var/run to make kaniko work. https://github.com/GoogleContainerTools/kaniko/issues/1001 — committed to psaxton/docker-koehn-diaspora by deleted user 4 years ago
hey folks, PR in progress. https://github.com/GoogleContainerTools/kaniko/pull/1025
Patch fix coming soon.
This is broken when using the Kaniko debug image in GitLab CI.
@tejal29 can confirm now it works with both v0.17.1 and debug-v0.17.1 without needing to add any additional flag (like it was before). Thanks!
Just ran into this as well. Do you plan to roll out a fix soon, or should we roll back?
To re-iterate, what we’d like to be able to see (ideally) is that Kaniko auto-detects Cloud Build environment, and automatically whitelists
/var/run. If that’s not possible, at least there should be (ideally) an option that preserves the old behavior by default (i.e. no need to whitelist /var/run explicitly), and then for those users who don’t need to whitelist it (i.e. non-Cloud Build users), they will be able to--whitelist-var-run=falseto disable this whitelisting explicitly…Otherwise, the current behavior breaks all Cloud Build jobs that are using
executor:latestorexecutor:debugimages, by requiring DevOps teams to adjust every build manually (to add the new argument). In addition, the current behavior does not seem to work at all in Cloud Build, with or without the new option (and both fortrueorfalse), so the only workaround atm is to use a pinned version<=0.16.0(which incidentally, also requires us to manually go and adjust all builds…)@dinvlad, @keylowgee, @artichaulo, @atikhono, @wintersolutions, The
gcr.io/kaniko-project/executor:debugnow points togcr.io/kaniko-project/executor:debug-v0.16.0We will also add a fix to retain the default behavior which is whitelisting
/var/runso that the current users are not affected.@tejal29
From a GitLab CI build:
@tejal29 here it is
Cloudbuild:
Dockerfile:
Logs:
Yes, and we also got that error in Cloud Build! I suspect it’s because CB has those images cached (because 0.17.0 was re-tagged). Maybe we could try the full sha256-based image tag…
Would it be possible to detect Cloud Build environment and set this option automatically instead, so that DevOps don’t have to apply this fix retroactively? Thanks
Could you add a note that we should use it in Cloud Build by default from now on? I.e. the default Cloud Build config suggested in README.md should be
Otherwise, it seems like this solution is not any different from where it started…
Hey folks, our v0.17.0 release is out!
Please use
--whitelist-var-run=falseto include/var/runin your destination image.Yeah, I could never get this flag to actually work. I guess I’ll revert to 0.15.0 while this gets resolved in some way.