Unpack the host's platform unless the flags name another - #2172
Closed
MayCXC wants to merge 2 commits into
Closed
Conversation
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.
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.
Type of Change
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
--platformstill 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
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
--platformpull 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 checkclean.