$ docker run --rm --privileged tonistiigi/binfmt --install all { "supported": [ "linux/amd64", "linux/arm64", "linux/riscv64", "linux/ppc64le", "linux/s390x", "linux/386", "linux/arm/v7", "linux/arm/v6" ], "emulators": [ "qemu-aarch64", "qemu-arm", "qemu-ppc64le", "qemu-riscv64", "qemu-s390x" ] }
ARG BUILDX_VERSION=0.4.2 ARG DOCKER_VERSION=latest FROM alpine AS fetcher RUN apk add curl ARG BUILDX_VERSION RUN curl -L \ --output /docker-buildx \ "https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-amd64" RUN chmod a+x /docker-buildx ARG DOCKER_VERSION FROM docker:${DOCKER_VERSION} COPY --from=fetcher /docker-buildx /usr/lib/docker/cli-plugins/docker-buildx
Credits to Jérémie Drouet
$ docker build --pull -t registry/docker-with-buildx . $ docker push registry/docker-with-buildx
Define CI_PLATFORMS variable in Settings / CI/CD:
CI_PLATFORMS = linux/amd64,linux/arm/v7,…
image: registry/docker-with-buildx services: - docker:dind build: stage: build script: - docker login -u $CI_USER -p $CI_TOKEN $CI_REGISTRY - docker buildx create --use - docker buildx build --platform $CI_PLATFORMS --push --pull -t $CI_REGISTRY_IMAGE .