Skip to content

no-from-platform

Dockerfilesuspiciousno fixdefault: offdockerfile/hadolint

Reports a FROM with a fixed --platform, such as --platform=linux/amd64. A value that contains $BUILDPLATFORM or $TARGETPLATFORM is not reported; other variables such as $TARGETARCH are.

A fixed platform ties the build to one CPU architecture. On an arm64 machine the base image is pulled for amd64 and runs under emulation, which is slow and sometimes breaks, and a multi-platform build produces the same amd64 content for every target.

Without the option the base follows the platform of the build; a stage that must run on the build machine uses --platform=$BUILDPLATFORM.

Reported
...
FROM --platform=linux/amd64 alpine:3
...
FROM alpine:3@sha256:abc
...
dockerfile:
lint:
rules:
no-from-platform: warn # off (default), warn, error

Enabled by the presets: dockerfile/hadolint.

Suppress one line with sudsy-disable-next-line no-from-platform in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
hadolint DL3029 full