How to build multi-platform images using remote BuildKit builder

Problem to solve

I am trying to build multi-platform docker image using BuildKit with multi-node config using remote builder.

Steps to reproduce

I’m trying to build image using docker-in-docker approach, something like this:

build-archive:
  image: docker:27
  stage: build
  tags:
    - docker-multiplatform
  services:
    - name: docker:27-dind
      alias: docker
  rules:
    - when: manual
  script:
    - docker build --platform linux/amd64,linux/arm64 --builder my-multi-node-builder-name ... 

However, it shows an error:

ERROR: no builder “my-multi-node-builder-name” found

Question: is there a way to use builder node configured on gitlab runner host machine or I need to create builder each time GitLab build is run with docker buildx create ...; docker buildx create --append ...

Configuration

I have a self-hosted GitLab runner on amd64 instance. Also, I have another instance on arm64 architecture which I try to use to build multi-platform image using Multiple native nodes approach. Multi-node builder is working fine, I can build image both for amd64 and arm64 architectures using multi-node builder from gitlab runner host console.

Versions

  • Self-managed
  • GitLab.com SaaS
  • Self-hosted Runners

Versions