Skip to content

Files

Latest commit

 

History

History
28 lines (17 loc) · 812 Bytes

DL3029.md

File metadata and controls

28 lines (17 loc) · 812 Bytes

Pattern: Use of --platform= with FROM

Issue: -

Description

Specifying --platform= in the docker file FROM clause forces the Image to build only one target platform. This has a number of negative consequences:

  • It is not possible to build a multi-platform Image from this Docker file.
  • The platform that you build on must be the same as the platform specified in --platform=

A better approach is to omit FROM --platform in the docker file and to specify in buildx --platform= during the build if control of the image platform target is needed.

Example of incorrect code:

FROM --platform=x86 busybox

Example of correct code:

FROM busybox

Further Reading