Cannot get multi-platform docker images to gitlab registry

I am trying to get multi-arch images working with our Gitlab registry, particularly amd64 and arm64 versions of the same image. I can build images for both platforms and have verified that they work on their appropriate platorm/os. The problem is that I cannot seem to be get both uploaded so that running docker pull ${REG_URL}/path/image:latest will pull the appropriate arch/version of the image for the requesting platform like it will from docker’s registry.

docker build \
--push \
--platform linux/arm64,linux/amd64 \
--tag ${REG_URL}/path/myapp-alpine316:latest \
--target alpine-alpine316 .

So far, when running a build that pushes two versions, the last one for the last platform pushed seems to overwrite the prior image. I have the same problem if I build & push natively on two different hosts (diff arch each). I’d really like to get this so that we can just do a docker pull of the image will fetch the correct platform rather than specifying arch in tags and all the extra scripting that will need to be made with our workflows. I feel like I’m missing something here but I don’t know what.

Gitlab-ce 15.10 running from the official docker image, self-hosted on RHEL7 with Docker 23.0.1

1 Like

I found a way of getting this to work by changing the build driver to docker-container. It doesn’t seem like this should be necessary, but it does get things working for pushing multi-platform images to our registry.

$ docker buildx create \
     --driver docker-container \
     --name multi-arch --use

After that switch, then the docker build command works fine, although isolated by the container it runs in.