linux
is supported as the build platform OS. Building with Windows containers will be available in a future version of Earthly.--platform
flag across various Earthfile commands or as part of the earthly
command, it is possible to override the build platform and thus be able to execute builds on non-native processor architectures. Execution of non-native binaries can be performed via QEMU emulation.RUN
), QEMU needs to be installed and set up. This will allow you perform Earthly builds on non-native platforms, but also incidentally, to run Docker images on your host system through docker run --platform=...
.docker run
command above enables execution of different multi-architecture containers by QEMU and binfmt_misc
. It only needs to be run once.BUILD --platform
flag. For example:+build
target were invoked without the use of any flag, Earthly would simply perform the build on the native architecture of the host system.+build-all-platforms
causes +build
to execute twice, in parallel: one time on linux/amd64
and another time on linux/arm/v7
.earthly
build command. For example:linux/arm64
architecture.FROM --platform
. For example:earthly --push +build-all-platforms
is executed, the build will push a multi-manifest image to the Docker registry. The manifest will contain two images: one for linux/amd64
and one for linux/arm/v7
. This works as such because both targets that save images use the exact same Docker tag for the image.docker
CLI has limited support for working with multi-manifest images locally. For this reason, when exporting an image to the local Docker daemon, Earthly provides the different architectures as different Docker tags.org/myimage:latest
org/myimage:latest_linux_amd64
(the same as org/myimage:latest
if running on a linux/amd64
host)org/myimage:latest_linux_arm_v7
RUN
on the target platform (and therefore emulation is not necessary):COPY
commands. The execution of the target +build
may take place on the host platform (in this case, linux/amd64
) and yet produce binaries for either amd64
or arm/v7
. Since there is no RUN
command as part of the +build-arm-v7
target, no emulation is necessary.TARGETPLATFORM
(eg linux/arm/v7
)TARGETOS
(eg linux
)TARGETARCH
(eg arm
)TARGETVARIANT
(eg v7
)USER
builtin build args can be used to determine the architecture of the host that called earthly
. This can be useful to determine if cross-platform emulation was used.USERPLATFORM
(eg linux/amd64
)USEROS
(eg linux
)USERARCH
(eg amd64
)USERVARIANT
(eg ``; an empty string for non-arm platforms)WITH DOCKER
has an important limitation for cross-platform builds: the target containing WITH DOCKER
needs to be executing on the native architecture of the host system. The images being run within WITH DOCKER
can be of any architecture, however.WITH DOCKER
starts up an isolated Docker daemon running within a container, and docker-in-docker is not yet supported in a QEMU environment.