Skip to content

Instantly share code, notes, and snippets.

@phosae
Created February 7, 2023 08:49
Show Gist options
  • Save phosae/8e12bfd21c9c2d7b938d1e98ab580e89 to your computer and use it in GitHub Desktop.
Save phosae/8e12bfd21c9c2d7b938d1e98ab580e89 to your computer and use it in GitHub Desktop.
Docker Buildx Args

https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope

The following ARG variables are set automatically:

  • TARGETPLATFORM - platform of the build result. Eg linux/amd64, linux/arm/v7, windows/amd64.
  • TARGETOS - OS component of TARGETPLATFORM, Eg linux, windows, wasi
  • TARGETARCH - architecture component of TARGETPLATFORM, Eg amd64, arm64, wasm32
  • TARGETVARIANT - variant component of TARGETPLATFORM
  • BUILDPLATFORM - platform of the node performing the build.
  • BUILDOS - OS component of BUILDPLATFORM
  • BUILDARCH - architecture component of BUILDPLATFORM
  • BUILDVARIANT - variant component of BUILDPLATFORM

docker buildx build --platform linux/amd64,linux/arm64 -t zengxu/example --push -f Dockerfile.dev .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment