microsoft/aspire · error · DistributedApplicationException
The Rust app ' ' targets ' ', which cannot be mapped to a…
Error message
The Rust app '{resource.Name}' targets '{target}', which cannot be mapped to a supported Docker Linux container platform. Generated Rust containers support native Linux x86_64, aarch64, 32-bit ARM, and 32-bit x86 targets. Use an authored Dockerfile to publish this target. What it means
During publish, Aspire maps a Rust target triple to a Docker Linux container platform. If the target triple does not have the <arch>-<vendor>-linux-<env> shape (custom target JSON files or non-Linux targets), the model cannot pick a native Docker platform and publishing fails, telling you to supply an authored Dockerfile instead.
Solutions
- Switch to a supported standard Linux target triple (x86_64-unknown-linux-musl, aarch64-unknown-linux-musl, etc.)
- Author your own Dockerfile and point the resource at it instead of relying on generated Dockerfile output
- If a custom target is required, keep it out of the container resource target and build via a custom Dockerfile
Example fix
// before
builder.AddRustApp("app", "./app").WithTargetTriple("x86_64-pc-windows-msvc");
// after
builder.AddRustApp("app", "./app").WithTargetTriple("x86_64-unknown-linux-musl"); Defensive patterns
Strategy: validation
Validate before calling
var isStandardLinuxTriple = target.Split('-') is { Length: >= 4 } p && p[2] == "linux";
if (!isStandardLinuxTriple) throw new InvalidOperationException($"{target} requires an authored Dockerfile"); Try / catch
try { appHost.PublishDockerfile(...); } catch (UnsupportedContainerTargetException ex) { /* fall back to an authored Dockerfile */ } Prevention
- Use only standard Rust Linux target triples for container resources
- Keep a custom Dockerfile ready when using custom target JSON specs
- Validate the target triple format before publish
When it happens
Trigger: Setting a RustAppHost's target to a custom target triple path (e.g. path to a .json target spec) or a non-Linux triple (e.g. x86_64-pc-windows-msvc) and running publish/dockerfile generation.
Common situations: Using an embedded/bare-metal target, a macOS/Windows target, or a project-specific custom target JSON file that Aspire cannot parse into architecture-vendor-linux-environment parts.
Understand the failure class
Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.
Related errors
- The Rust app ' ' targets ' ', which requires container…
- The Rust app ' ' targets ' ', but the default Rust build…
- The Rust app ' ' targets ' ', which is not compatible with…
- Container runtime ' ' is not running or is unhealthy.
- Container runtime did not return image configuration for
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/5789e31c42bf2885.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Rust/RustHostingExtensions.cs:872
RustAppResource resource,
ContainerResource container)
{
var target = resource.TryGetLastAnnotation<RustCargoOptionsAnnotation>(out var options)
? options.Target
: null;
if (target is null)
{
return null;
}
// Built-in Rust Linux targets use <architecture>-<vendor>-linux-<environment>, for example
// armv7-unknown-linux-musleabihf. Custom target JSON paths and non-Linux targets do not carry enough
// information to choose a native Docker platform and therefore need an authored Dockerfile.
var targetParts = target.Split('-');
if (targetParts.Length < 4 || !string.Equals(targetParts[2], "linux", StringComparison.Ordinal))
{
throw CreateUnsupportedContainerTargetException(resource, target);
}
var architecture = targetParts[0];
// ContainerTargetPlatform.LinuxArm emits Docker's canonical linux/arm platform, which containerd
// normalizes to the v7 variant. See https://github.com/containerd/platforms/blob/main/platforms.go.
var platform = architecture switch
{
"x86_64" => ContainerTargetPlatform.LinuxAmd64,
"aarch64" => ContainerTargetPlatform.LinuxArm64,
"i386" or "i486" or "i586" or "i686" => ContainerTargetPlatform.Linux386,
"arm" or "armv4t" or "armv5te" or "armv7" or "thumbv7neon" => ContainerTargetPlatform.LinuxArm,
_ => throw CreateUnsupportedContainerTargetException(resource, target)
};
var targetEnvironment = targetParts[3];
// The official Rust image index used by the default build stage publishes amd64 and arm64 images,
// but not Docker's 32-bit arm or 386 platforms. Those architectures therefore need a custom build
// image even when the default Alpine runtime image already supports the target platform.View on GitHub (pinned to 25830f84bd)