Skip to content

Commit 9030fbb

Browse files
committed
ContainerRegistry: when pulling the image from the registry, container needs the platform annotation - image load is ok without it
1 parent 3f92229 commit 9030fbb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Sources/containertool/Extensions/RegistryClient+publish.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ func publishContainerImage<Source: ImageSource, Destination: ImageDestination>(
155155
ContentDescriptor(
156156
mediaType: manifestDescriptor.mediaType,
157157
digest: manifestDescriptor.digest,
158-
size: Int64(manifestDescriptor.size)
158+
size: Int64(manifestDescriptor.size),
159+
platform: .init(architecture: architecture, os: os)
159160
)
160161
]
161162
)

scripts/test-containertool-elf-detection.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ FILETYPE=$(file "$PKGPATH/.build/x86_64-swift-linux-musl/debug/hello")
4545
log "Executable type: $FILETYPE"
4646

4747
IMGREF=$(swift run containertool --repository localhost:5000/elf_test "$PKGPATH/.build/x86_64-swift-linux-musl/debug/hello" --from scratch)
48-
$RUNTIME pull "$IMGREF"
48+
$RUNTIME pull --platform=linux/amd64 "$IMGREF"
4949
IMGARCH=$($RUNTIME inspect "$IMGREF" --format "{{.Architecture}}")
5050
if [ "$IMGARCH" = "amd64" ] ; then
5151
log "x86_64 detection: PASSED"
@@ -61,7 +61,7 @@ FILETYPE=$(file "$PKGPATH/.build/x86_64-swift-linux-musl/debug/hello")
6161
log "Executable type: $FILETYPE"
6262

6363
IMGREF=$(swift run containertool --repository localhost:5000/elf_test "$PKGPATH/.build/aarch64-swift-linux-musl/debug/hello" --from scratch)
64-
$RUNTIME pull "$IMGREF"
64+
$RUNTIME pull --platform=linux/arm64 "$IMGREF"
6565
IMGARCH=$($RUNTIME inspect "$IMGREF" --format "{{.Architecture}}")
6666
if [ "$IMGARCH" = "arm64" ] ; then
6767
log "aarch64 detection: PASSED"

0 commit comments

Comments
 (0)