Skip to content

Recompress slim layers to gzip before pushing#33

Merged
richturner merged 1 commit intomainfrom
fix/slim-push-gzip-layers
May 8, 2026
Merged

Recompress slim layers to gzip before pushing#33
richturner merged 1 commit intomainfrom
fix/slim-push-gzip-layers

Conversation

@Miggets7
Copy link
Copy Markdown
Contributor

@Miggets7 Miggets7 commented May 7, 2026

Summary

Follow-up to #32. After it landed, the slim variant on Docker Hub was larger than the un-slimmed base (develop-slim 2.56 GB amd64 / 2.48 GB arm64 vs develop 1.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 — while develop's layers were ...tar.gzip. docker save always 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 --replace step between import and digest computation. It rewrites layer blobs to application/vnd.oci.image.layer.v1.tar+gzip in place. The digest is captured after the mod, since recompressing layers changes layer digests → manifest digest.

Verified locally that image mod --layer-compress gzip does 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 mod is tagged EXPERIMENTAL by upstream — meaning the flag interface may evolve in future versions, not that the command is unstable. Since release: v0.11.3 is pinned, the surface is locked.

`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.
@Miggets7 Miggets7 requested a review from richturner May 7, 2026 10:32
@richturner richturner merged commit 6b8d224 into main May 8, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants