Skip to content

Unpack the host's platform unless the flags name another - #2172

Closed
MayCXC wants to merge 2 commits into
apple:mainfrom
MayCXC:unpack-host-platform
Closed

Unpack the host's platform unless the flags name another#2172
MayCXC wants to merge 2 commits into
apple:mainfrom
MayCXC:unpack-host-platform

Conversation

@MayCXC

@MayCXC MayCXC commented Aug 27, 2026

Copy link
Copy Markdown

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Closes #2165.

A pull, load, or build with no platform unpacked a snapshot for every platform in the image's index. Only the host's platform is ever mounted from this store, so on an arm64 machine each multi-arch reference paid for amd64, s390x, riscv64, and the rest as full ext4 snapshots nothing could use; five small images measured 20G of snapshots this way.

Every pulled platform stays in the content store, and the host's platform is what gets unpacked when no flag names one. An image that does not carry the host platform stays packed, the way a foreign-only image arrives from a load or a cross-platform build; any platform unpacks on demand when something asks to use it, which is also how a Rosetta run of an amd64 image acquires its snapshot. An explicit --platform still unpacks exactly what it names.

The engine default a reference would give is one platform per pull, the host's, which scopes what is fetched as well as what is unpacked: https://docs.docker.com/reference/cli/docker/image/pull/ . Fetching every platform and narrowing only the unpacking is this store's own choice, and it keeps a foreign platform available to run under Rosetta or to be pushed on without a second fetch. What that costs is compressed blobs, against the ext4 snapshot per platform that unpacking them all cost.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

New integration coverage reads the store's snapshot directories directly: after a plain pull of a multi-arch reference the host platform's variant is unpacked and the foreign ones stay packed, and an explicit --platform pull unpacks exactly what it names. The inspect fixture type gains the variant digest those assertions resolve.

Integration suite: 397 passed. Unit suite: 772 passed. make fmt, make check clean.

MayCXC added 2 commits August 27, 2026 20:16
A pull, load, or build with no platform unpacked a snapshot for every
platform in the image's index. Only the host's platform is ever mounted
from this store, so on an arm64 machine each multi-arch reference paid
for amd64, s390x, riscv64, and the rest as full ext4 snapshots nothing
could use; five small images measured 20G of snapshots this way.

Keep every pulled platform in the content store and unpack the host's
platform when no flag names one. An image that does not carry the host
platform stays packed, the way a foreign-only image arrives from a load
or a cross-platform build; any platform unpacks on demand when something
asks to use it, which is also how a Rosetta run of an amd64 image
acquires its snapshot. An explicit --platform still unpacks exactly what
it names.

The engine default a reference would give is one platform per pull, the
host's, which scopes what is fetched as well as what is unpacked:
https://docs.docker.com/reference/cli/docker/image/pull/
Fetching every platform and narrowing only the unpacking is this store's
own choice, and it keeps a foreign platform available to run under
Rosetta or to be pushed on without a second fetch. What that costs is
compressed blobs, against the ext4 snapshot per platform that unpacking
them all cost.
The store's snapshot directories carry the truth: after a plain pull of
a multi-arch reference the host platform's variant is unpacked and the
foreign ones stay packed, and an explicit --platform pull unpacks
exactly what it names. The inspect fixture type gains the variant
digest the assertions resolve.
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.

[Bug]: A pull with no --platform unpacks an ext4 snapshot for every platform in the index

2 participants