Loading tutorials
FROM instructions in one Dockerfile. Each FROM starts a new stage, and the last stage becomes the image you ship. This chapter covers the working model of stages. Later chapters add platform-aware stages to it.3 min readFROM ... AS and COPY --from. It also assumes you know that CPUs come in different architectures such as amd64 and arm64. Later chapters build on the two terms defined here.3 min readamd64 and arm64 are different CPU architectures. It also assumes you know the difference between the build platform (the machine running the build) and the target platform (the machine the image will run on).3 min readdocker build. It also assumes you know the names amd64 and arm64. It covers the build arguments BuildKit sets for you and how to read their values.3 min readBUILDPLATFORM and TARGETPLATFORM mean. It covers one rule that causes many silent cross-compilation bugs. BuildKit defines the platform arguments for you, but a stage can only read them in RUN and other instructions afte2 min readFROM --platform to choose which platform each stage runs on.3 min readBUILDPLATFORM and TARGETPLATFORM mean. You should also know that ARGs must be declared inside a stage before you use them, and that FROM --platform=$BUILDPLATFORM pins a stage to the build machine.3 min readBUILDPLATFORM, TARGETOS and TARGETARCH mean. It also assumes your Go build stage already uses FROM --platform=$BUILDPLATFORM. Here you will run that Dockerfile for several platforms with one command.3 min readdocker buildx build and that you know the build and target platform terms from earlier chapters. It explains what the registry stores when you push a multi-platform image, and how a pull picks the right image.3 min readFROM --platform=$BUILDPLATFORM, and you have declared TARGETOS and TARGETARCH with ARG. Here you extend that setup to 32-bit ARM, where the architecture name alone is not enough.2 min readFROM --platform=$BUILDPLATFORM and the TARGETOS and TARGETARCH arguments from earlier chapters.2 min readFROM --platform=$BUILDPLATFORM pins a stage to the build machine. You should also know how TARGETOS and TARGETARCH feed GOOS and GOARCH. The Go examples so far set CGO_ENABLED=0. This chapter covers what changes3 min readBUILDPLATFORM, TARGETOS and TARGETARCH mean, and have run docker buildx build --platform at least once. Here you check that each architecture got the right binary, and you learn the mistakes that most often break a cross-2 min read