Repository navigation
Conversation
|
Tested ef55fd7 on an M-series Mac (macOS 27), built from main 31e3a98 with this PR merged (plus #2380, which doesn't touch pull), using a fresh
For anyone measuring disk usage while testing this: on main the snapshots are also much smaller (alpine 41 MB allocated vs 1.09 GB on 1.5.0). That comes from the journal fix in containerization#924, not from this PR. |
ef55fd7 to
e0d3787
Compare
|
Thanks for testing this on current main — that's the confirmation the PR needed, and the note about containerization#924 is important. I've rebased on 31e3a98 and reworked the flag: instead of a separate --all-platforms (which quietly did the wrong thing when CONTAINER_DEFAULT_PLATFORM was set), the existing --platform option now accepts �ll. Default pulls unpack only the resolved platform; all blobs are still fetched, and other platforms unpack on demand. I also corrected the PR's disk figures, since #924 makes per-snapshot allocation much smaller than the 1.5.0 numbers originally quoted. |
Pulling a multi-arch image unpacked a snapshot for every platform in the index, even though run only needs the requested platform. Unpack only the resolved platform and fall back to the host platform when none is specified, so a default pull creates one snapshot. Blobs for every platform are still fetched, preserving offline use. Add --platform all to restore unpacking every platform. This replaces the earlier --all-platforms flag, which did not work when CONTAINER_DEFAULT_PLATFORM was set.
e0d3787 to
6b62684
Compare
Type of Change
Motivation and Context
container image pullwithout--platformunpacks a snapshot for every architecture in the image index, whilerununpacks only the requested platform viagetCreateSnapshot(related: #784, #2165). Each snapshot is much smaller since containerization#924, but a multi-arch image still pays the per-architecture multiplier:alpine:latestcreates a snapshot and repeats the unpack work for every platform in the index, although only one will run.This change unpacks only the resolved platform. If
--platform,--os,--arch, orCONTAINER_DEFAULT_PLATFORMis provided, that platform is used; otherwise the host platform is used. Blob fetching is unchanged, so images remain usable offline.--platform allrestores the previous unpack-every-platform behavior, and other platforms are still unpacked on demand byrun --platform.Using the existing
--platformoption instead of a separate--all-platformsflag keeps one way to select platforms.--platform allis mutually exclusive with--osand--arch.Testing
Tests/ContainerCommandsTests/ImagePullPlatformTests.swift): default host, explicit platform, environment default,all, case-insensitiveall, and conflicting flags.docs/command-reference.md).alpine:latestandpostgres:18each unpacked a singlelinux/arm64snapshot, and containers started and ran normally.Functional testing compares snapshot counts, since containerization#924 already reduced allocated bytes per snapshot. The remaining win is one snapshot and one unpack pass instead of one per architecture.