Automatic platform ARGs in the global scope
This feature is only available when using theBuildKitbackend.
BuildKit supports a predefined set ofARGvariables with information on the platform of
the node performing the build (build platform) and on the platform of the
resulting image (target platform). The target platform can be specified with
the--platformflag ondocker build.
The followingARGvariables are set automatically:
TARGETPLATFORM- platform of the build result. Eglinux/amd64,linux/arm/v7,windows/amd64.TARGETOS- OS component of TARGETPLATFORMTARGETARCH- architecture component of TARGETPLATFORMTARGETVARIANT- variant component of TARGETPLATFORMBUILDPLATFORM- platform of the node performing the build.BUILDOS- OS component of BUILDPLATFORMBUILDARCH- architecture component of BUILDPLATFORMBUILDVARIANT- variant component of BUILDPLATFORM
These arguments are defined in the global scope so are not automatically
available inside build stages or for yourRUNcommands. To expose one of
these arguments inside the build stage redefine it without value.
For example: