Skip to content

deb: stop forcing xz compression instead of zstd - #552

Draft
thaJeztah wants to merge 1 commit into
docker:mainfrom
thaJeztah:z_the_zstd
Draft

thaJeztah wants to merge 1 commit into
docker:mainfrom
thaJeztah:z_the_zstd

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

relates to:

This override was originally added in docker-ce-packaging@0f4c193. At the time, our deploy pipeline used dpkg-sig to sign individual packages to allow them to be verified when installing offline. The override was added because Ubuntu 21.10 switched the default compression for .deb packages to use zstd, which is not compatible with dpkg-sig.

Given that dpkg-sig has not received updates since 2006 and now removed 2, we stopped using it and stopped signing individual packages, so we can remove the override and use the defaults as used by the distro.

Before:

docker buildx bake pkg-docker-engine-ubuntu2604 --set pkg-docker-engine-ubuntu2604.platforms=linux/arm64

ls -l ./bin/pkg/docker-engine/ubuntu2604/linux_arm64/ubuntu/resolute/arm64/
total 61720
-rw-r--r--@ 1 thajeztah  staff      7719 Nov  3 13:02 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.buildinfo
-rw-r--r--@ 1 thajeztah  staff      1942 Nov  3 13:02 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.changes
-rw-r--r--@ 1 thajeztah  staff  21099564 Nov  3 13:02 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.deb
-rw-r--r--@ 1 thajeztah  staff   9130404 Nov  3 13:02 docker-ce-rootless-extras_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.deb

After:

docker buildx bake pkg-docker-engine-ubuntu2604 --set pkg-docker-engine-ubuntu2604.platforms=linux/arm64

ls -l ./bin/pkg/docker-engine/ubuntu2604/linux_arm64/ubuntu/resolute/arm64/
total 67864
-rw-r--r--@ 1 thajeztah  staff      7719 Nov  3 13:05 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.buildinfo
-rw-r--r--@ 1 thajeztah  staff      1942 Nov  3 13:05 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.changes
-rw-r--r--@ 1 thajeztah  staff  24165166 Nov  3 13:05 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.deb
-rw-r--r--@ 1 thajeztah  staff   9821436 Nov  3 13:05 docker-ce-rootless-extras_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.deb

For Ubuntu 26.04 (arm64), this increases the combined package size from 30.23 MB to 33.99 MB (+12.4%), but significantly reduces extraction time and CPU usage.

Benchmark results for docker-ce (5 runs, median):

              xz       zstd

Extraction 0.550s 0.209s
User CPU 1.215s 0.126s
System CPU 0.438s 0.118s

This reduces extraction wall time by approximately 62%, while also reducing CPU usage considerably.

Comment thread pkg/agent/deb/rules
# force packages to be built with xz compression, as Ubuntu 21.10 and up use
# zstd compression, which is non-standard, and breaks 'dpkg-sig --verify'
override_dh_builddeb:
dh_builddeb -- -Zxz

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could consider bumping the compression level (default is 19?), to get back some of the size, but it will increase build-times;

dh_builddeb -- -Zzstd -z22
zstd default	zstd -22
Combined package size	33.99 MB	32.65 MB
Increase over xz	+12.4%	+8.0%
Median extraction vs xz	62% faster	51% faster
Median user CPU vs xz	90% less	87% less

This override was originally added in [docker-ce-packaging@0f4c193][1]. At the
time, our deploy pipeline used `dpkg-sig` to sign individual packages to
allow them to be verified when installing offline. The override was added
because Ubuntu 21.10 switched the default compression for .deb packages to
use zstd, which is not compatible with `dpkg-sig`.

Given that dpkg-sig has not received updates since 2006 and now removed [2],
we stopped using it and stopped signing individual packages, so we can remove
the override and use the defaults as used by the distro.

Before:

    docker buildx bake pkg-docker-engine-ubuntu2604 --set pkg-docker-engine-ubuntu2604.platforms=linux/arm64

    ls -l ./bin/pkg/docker-engine/ubuntu2604/linux_arm64/ubuntu/resolute/arm64/
    total 61720
    -rw-r--r--@ 1 thajeztah  staff      7719 Nov  3 13:02 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.buildinfo
    -rw-r--r--@ 1 thajeztah  staff      1942 Nov  3 13:02 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.changes
    -rw-r--r--@ 1 thajeztah  staff  21099564 Nov  3 13:02 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.deb
    -rw-r--r--@ 1 thajeztah  staff   9130404 Nov  3 13:02 docker-ce-rootless-extras_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.deb

After:

    docker buildx bake pkg-docker-engine-ubuntu2604 --set pkg-docker-engine-ubuntu2604.platforms=linux/arm64

    ls -l ./bin/pkg/docker-engine/ubuntu2604/linux_arm64/ubuntu/resolute/arm64/
    total 67864
    -rw-r--r--@ 1 thajeztah  staff      7719 Nov  3 13:05 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.buildinfo
    -rw-r--r--@ 1 thajeztah  staff      1942 Nov  3 13:05 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.changes
    -rw-r--r--@ 1 thajeztah  staff  24165166 Nov  3 13:05 docker-ce_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.deb
    -rw-r--r--@ 1 thajeztah  staff   9821436 Nov  3 13:05 docker-ce-rootless-extras_0.0.0~20261103082347~b1bf127-1~ubuntu.26.04~resolute_arm64.deb

For Ubuntu 26.04 (arm64), this increases the combined package size
from 30.23 MB to 33.99 MB (+12.4%), but significantly reduces extraction
time and CPU usage.

Benchmark results for docker-ce (5 runs, median):

                  xz       zstd
Extraction     0.550s    0.209s
User CPU       1.215s    0.126s
System CPU     0.438s    0.118s

This reduces extraction wall time by approximately 62%, while also
reducing CPU usage considerably.

[1]: docker/docker-ce-packaging@0f4c193
[2]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=995113

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant