Dockerfile Cheat Sheet/Build for specific platform

Build for a target platform when supported.

Section: Build Flags and Targets

Build for specific platform

bash
bash
docker build --platform linux/amd64 -t myapp:amd64 .
Explanation

Often used together with Buildx or multi-platform workflows.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Build Flags and Targets
Build a specific stage
Build only up to a named stage.
OpenIn sheetbashsame section
Pass build args
Pass values for Dockerfile `ARG` instructions.
OpenIn sheetbashsame section
Build without cache
Rebuild all steps without using cache.
OpenIn sheetbashsame section
Always pull newer base image
Attempt to pull a newer base image before build.
OpenIn sheetbashsame section
Use plain progress output
Render verbose plain-text build output.
OpenIn sheetbashsame section
Build from Dockerfile
Build an image from the Dockerfile in the current directory.
OpenIn sheetbash2 tag match