Skip to main content
Do not use —platform flag with constant value in FROM.
Superseded by buildkit/FromPlatformFlagConstDisallowed, which provides the same check with improved diagnostics.

Description

Using a hardcoded --platform value in FROM restricts image building to a single target platform. Use $BUILDPLATFORM or similar variables instead.

Examples

Problematic code

FROM --platform=linux/amd64 alpine

Correct code

FROM --platform=${BUILDPLATFORM} alpine

Reference