How to create Multi-Platform Container Images
Posted on November 9, 2026 • 3 <no value> minutes • 508 <no value> words
Table of contents
Using the .NET SDK for Multi-arch Images
Note
Chet reached out to me right after I published this post and shared the good news that the .NET SDK now supports multiple architectures in a single build .
Here’s my older example but using a single build for both architectures at the same time:
dotnet publish ./MyCoolApp.csproj \ -t:PublishContainer \ -p PublishProfile=DefaultContainer \ -p ContainerBaseImage="mcr.microsoft.com/dotnet/aspnet:10.0" \ -p ContainerRegistry="docker.io" \ -p ContainerRepository="lancemccarthy/my-cool-app" \ -p ContainerImageTag="latest-arm64" \ -p ContainerRuntimeIdentifiers="linux-x64;linux-arm64"Notice we’re using
ContainerRuntimeIdentifiers="linux-x64;linux-arm64"instead of--arch "x64"for one build and--arch "arm64"for the other build? That means all of the stuff I shopwed you below is no longer needed.
The .NET SDK now has the ability to create a container image right from the SDK using -t:PublishContainer, but there’s a limitation where you can only use a single target platform (x64, arm64, etc). However, most production worlflows and apps need to have support for both x65 and ARM64 machines.
Let me show you a trick using manifests to create a single image tag that has both! The idea is to create both images, setting the --arch each time.
Create the x64 image
First, lets create the x64 one:
dotnet publish ./MyCoolApp.csproj \
-t:PublishContainer \
-p PublishProfile=DefaultContainer \
-p ContainerBaseImage="mcr.microsoft.com/dotnet/aspnet:10.0" \
-p ContainerRegistry="docker.io" \
-p ContainerRepository="lancemccarthy/my-cool-app" \
-p ContainerImageTag="latest-x64" \
--arch "x64"
That creates the linux/x64 image named lancemccarthy/my-cool-app:latest-x64.
Create the x64 image
Now, lets create the ARM64 one (notice we only change x64 to arm64):
dotnet publish ./MyCoolApp.csproj \
-t:PublishContainer \
-p PublishProfile=DefaultContainer \
-p ContainerBaseImage="mcr.microsoft.com/dotnet/aspnet:10.0" \
-p ContainerRegistry="docker.io" \
-p ContainerRepository="lancemccarthy/my-cool-app" \
-p ContainerImageTag="latest-arm64" \
--arch "arm64"
That creates the linux/arm64 image named lancemccarthy/my-cool-app:latest-arm64.
Combine the images into a single manifest
Finally, here’s how we combine them into a single manifest for lancemccarthy/my-cool-app:latest then list the two separate images you created earlier
# if you're not already logged into your container registry, do that now
docker login "docker.io" -u "your-username" -p "your-password"
# We create a manifest using the two images
docker manifest create "lancemccarthy/my-cool-app:latest" "lancemccarthy/my-cool-app:latest-x64" "lancemccarthy/my-cool-app:latest-arm64"
# push to your registry
docker manifest push "lancemccarthy/my-cool-app:latest"
Tip
If you prefer sticking to the .NET SDK, you can combine these into a command stack in a ps1 file that is simple to execute.
Create a new file named build-and-publish-images.ps1 and use the following content
# Set some handy variables
$baseImageName="mcr.microsoft.com/dotnet/aspnet:10.0"
$appImageName="lancemccarthy/my-cool-app"
$containerRegistry="docker.io"
$csprojPath="./MyCoolApp.csproj"
# Prerequisite: If you're not already logged into your container registry, do that now.
docker login $containerRegistry -u "your-username" -p "your-password"
# Step 1: Build & publish x64
dotnet publish $csprojPath \
-t:PublishContainer \
-p PublishProfile=DefaultContainer \
-p ContainerBaseImage=$baseImageName \
-p ContainerRegistry=$containerRegistry \
-p ContainerRepository=$appImageName \
-p ContainerImageTag="latest-x64" \
--arch "x64"
# Step 2: Build & publish arm64
dotnet publish $csprojPath \
-t:PublishContainer \
-p PublishProfile=DefaultContainer \
-p ContainerBaseImage=$baseImageName \
-p ContainerRegistry=$containerRegistry \
-p ContainerRepository=$appImageName \
-p ContainerImageTag="latest-arm64" \
--arch "arm64"
# Step 3: Publish the x64 + arm64 manifest
# We create a manifest using the two images
docker manifest create "$($appImageName):latest" \
"$($appImageName):latest-x64" \
"$($appImageName):latest-arm64"
# push to your registry
docker manifest push "$($appImageName):latest"

Chet