skip to Main Content

I am looks for a method to produce docket image without compression. I need this because the decompression of the image is to slow on the target machine.

I tried at add this option to the build command "–output type=image,compression=uncompressed,force-compression=true". But the result does not look different from the one without these parameter.

Anyone had experience in producing an image without compression?

-zz

2

Answers


  1. Chosen as BEST ANSWER

    The parameter is correct in the form of --output type=image,compression=uncompressed,force-compression=true --push

    I figured why it was not working. If you use default docker builder, it seems not taking this parameter. If you a builder based on docker-container, it will work as expected.

    So you will need to run

    docker buildx create --name my-builder --driver docker-container

    followed by

    docker buildx use my-builder

    before issuing the docker buildx build command


  2. buildkit does output uncompressed layers with the --output type=image,compression=uncompressed,force-compression=true --push parameters, but it’s important that you push those layers from buildkit and not from the docker engine. Once the layers are loaded into the docker engine, pushing to a registry repackages the layers and regenerates the manifest.

    You can inspect the manifest with tools like docker buildx imagetools inspect --raw $image on the specific image (you’ll need to include the digest of your platform specific image), or regctl manifest get --platform local $image to see the change in the layer media type value (ending in .tar instead of .tar+gzip).

    After an image is created with compressed layers, you can also modify the the image using regctl. If you output to an OCI Layout (extracted from the tar into a directory), regclient/regctl can even do this locally before pushing to a registry (using the ocidir://$path:$tag syntax to reference the image).

    The regctl command to change layer compression is:

    regctl image mod --layer-compress=none $cur_image --create $new_image
    

    You can also try zstd compression to see if that’s fast enough for you (with either regctl or buildkit’s output option).

    That said, typically the compression itself isn’t the slow part, but rather the filesystem I/O of writing all of the uncompressed files to disk, and there’s no way around downloading the tar and then extracting that tar file to disk. Removing compression just means it takes longer for those layers to be initially downloaded.

    Disclaimer, I’m the author of regclient that includes regctl.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search