Recompress slim layers to gzip before pushing#33
Merged
richturner merged 1 commit intomainfrom May 8, 2026
Merged
Conversation
`docker save` writes uncompressed layer tarballs (`application/vnd.oci.image.layer.v1.tar`). Pushed as-is, the slim image landed in the registry as a single ~2.56 GB uncompressed blob — larger than the un-slimmed base — so the slim toolkit's size win was being thrown away on the way out. Insert a `regctl image mod --layer-compress gzip --replace` step between import and digest computation so layers are rewritten to `application/vnd.oci.image.layer.v1.tar+gzip` before the push. The digest must be computed after the mod step since recompressing layers changes the manifest digest.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #32. After it landed, the slim variant on Docker Hub was larger than the un-slimmed base (
develop-slim2.56 GB amd64 / 2.48 GB arm64 vsdevelop1.91 GB / 1.97 GB).Inspecting the manifests showed why: the slim image had a single layer with media type
application/vnd.oci.image.layer.v1.tar— uncompressed — whiledevelop's layers were...tar.gzip.docker savealways writes uncompressed layer tarballs, and the import → copy pipeline shipped them to the registry as-is, throwing away the slim toolkit's actual size win.Insert a
regctl image mod --layer-compress gzip --replacestep between import and digest computation. It rewrites layer blobs toapplication/vnd.oci.image.layer.v1.tar+gzipin place. The digest is captured after the mod, since recompressing layers changes layer digests → manifest digest.Verified locally that
image mod --layer-compress gzipdoes what's advertised: round-tripping alpine through--layer-compress none(8.0 MB uncompressed) →--layer-compress gzip(3.6 MB) recovers the gzipped form, and the layer media type updates correctly.regctl image modis tagged EXPERIMENTAL by upstream — meaning the flag interface may evolve in future versions, not that the command is unstable. Sincerelease: v0.11.3is pinned, the surface is locked.