FahamLah

Commands

docker buildx build --platform

docker buildx build --platform <os/cpu>[,<os/cpu>] -t <name:tag> <folder>

Risk: Safe

What it does

Builds one image for several CPU types (platforms) at once.

When to use it

When your image must run on both amd64 and arm64 machines.

Example

$ docker buildx build --platform linux/amd64,linux/arm64 -t hello:1.0 .

One name, a pack for each CPU.

$ docker images --tree hello

See the packs inside one name.

$ docker build --secret id=npm_token,src=token.txt -t api:1.0 .

Lend a secret to RUN --mount=type=secret steps.