Docker "FROM --platform invalid" in CI
A FROM --platform=os/arch[/variant] line pins the base image platform. A typo (linux/amd instead of linux/amd64), an unknown OS, or a bad variant makes BuildKit reject the platform string before it pulls the base.
What this error means
A build fails on the FROM --platform=... line with invalid platform or unknown operating system or architecture.
docker
ERROR: failed to solve: failed to parse platform linux/amd: unknown operating system or architecture: invalid argumentCommon causes
A typo in os/arch
Values like linux/amd, linux/x86_64, or linux/arm (missing the version) are not valid platform identifiers.
An interpolated build arg that is empty or wrong
A FROM --platform=$TARGETPLATFORM where the arg is unset or set to garbage produces an invalid string.
How to fix it
Use a valid platform identifier
- Use the canonical os/arch form, e.g.
linux/amd64,linux/arm64, orlinux/arm/v7.
Dockerfile
FROM --platform=linux/amd64 golang:1.22 AS buildRely on the automatic build platform args
- Prefer
$BUILDPLATFORM/$TARGETPLATFORM, which BuildKit fills with valid values.
Dockerfile
FROM --platform=$BUILDPLATFORM golang:1.22 AS build
ARG TARGETOS TARGETARCH
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH go build ./...How to prevent it
- Use canonical
os/archstrings; let BuildKit supply$TARGETPLATFORM. - Validate any interpolated platform arg before the build.
Related guides
Docker "no match for platform in manifest" - Fix Multi-Arch BuildsFix Docker "no match for platform in manifest" in CI - pulling or building for an architecture the image does…
Docker "image found but does not match the specified platform"Fix Docker "image ... does not match the specified platform" / "image operating system linux cannot be used o…