kaniko icon indicating copy to clipboard operation
kaniko copied to clipboard

compression=zstd not working starting from v1.16

Open routehero opened this issue 10 months ago • 0 comments

Actual behavior gcr.io/kaniko-project/executor:v1.15.0-debug is able to produce layers compressed with zstd

gcr.io/kaniko-project/executor:v1.22.0-debug throws an error:

error building image: error building stage: failed to save snapshot to image: gzip: invalid compression level: 20

This error doesn't make sense if kaniko were using zstd. Removing --compression-level=20 from the args allows kaniko to succeed, but the layers are compressed with gzip.

Expected behavior When using --compression=zstd, the layers produced should be compressed with zstd.

To Reproduce Steps to reproduce the behavior:

  1. starting from v1.16.0 up to and including v1.22.0, use args: --compression=zstd --compression-level=20 --single-snapshot
  2. remove --compression-level=20, then run docker manifest inspect on the newly created image. you will only see gzip.

Additional Information

  • Dockerfile FROM python:3.8 WORKDIR /app CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 app:app

  • Kaniko Image v1.15 (working): gcr.io/kaniko-project/executor@sha256:9a798741047d3761221100f586ea9fa8a3f09957176630faeb77923894b7355a v1.22 (not working): gcr.io/kaniko-project/executor@sha256:7b3699e9e105521075812cd3f3f4c62c913cb5cd113c929975502022df3bcf60

  • Sidequest? docker buildx has a force-compression parameter, that recompresses base layers as zstd. adding this as an option to kaniko would be helpful.

Triage Notes for the Maintainers

Description Yes/No
Please check if this a new feature you are proposing
  • - [N]
Please check if the build works in docker but not in kaniko
  • - [Y]
Please check if this error is seen when you use --cache flag
  • - [Y]
Please check if your dockerfile is a multistage dockerfile
  • - [N]

routehero avatar May 03 '24 16:05 routehero