kaniko: error building image: error building stage: gzip: invalid header
Actual behavior The dockerfile command RUN and USER will lead to “unpack rootfs”, which causing “error building image: error building stage: gzip: invalid header”. But the error only happens in some specific images.
Expected behavior It should work fine.
To Reproduce Steps to reproduce the behavior: build the image with kaniko.
Additional Information
- Dockerfile works wrong
FROM myimage
USER root
RUN chmod 1777 /tmp
ADD test.txt /tmp/
- Dockerfile works right
FROM myimage
ADD test.txt /tmp/
- log
INFO[0000] Executing 0 build triggers
INFO[0000] Unpacking rootfs as cmd RUN chmod 1777 /tmp requires it.
error building image: error building stage: gzip: invalid header
- Kaniko Image v0.10.0
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 7
- Comments: 17 (6 by maintainers)
Seems like I’m running into this as well. Tracked it down to trying to run a command in an Ubuntu 20.04 image pulled from Amazon’s new public registry.
So basically, this image fails: public.ecr.aws/lts/ubuntu@sha256:aed3a67ccca8f308fa5e367918f91dde88fb79c5d72e0d139e799da89634bd9e
And this image works: ubuntu@sha256:376209074d481dca0a9cf4282710cd30a9e7ff402dea8261acdaaf57a18971dd
I hope that helps! I was using Kaniko v1.6.0.
@drpmma could you fix the issue? I’m getting the same error, and trying to build with Buildah works properly… but I need Kaniko for CI.
The image is not built by kaniko. And the image can be extracted and run correctly by docker.
Below are the logs. The error is here. https://github.com/GoogleContainerTools/kaniko/blob/master//pkg/util/fs_util.go#L87