Force docker gitlab-runner to use amd64 on Apple M1
Summary
I've installed docker and gitlab-runner (brew install gitlab-runner), and registered a docker runner on my pipeline. I also have a native macos runner working fine. I can't for the life of me figure out how to force the docker (dind) runner to build amd64 images instead of arm64 images. I've tried the DOCKER_DEFAULT_PLATFORM env variable in various places, I've also tried specifying a x86_64 gitlab-runner helper image (which does actually run as x86_64), but the build itself still runs as arm64.
Steps to reproduce
brew install gitlab-runner- Install docker
- gitlab-runner register (use docker executor).
- Try everything possible to force the runner to build amd64
- Give up and create an issue here
What is the current bug behavior?
The gitlab runner always builds amd64 images
What is the expected correct behavior?
There should be some way of specifying the gitlab-runner to build/run an amd64 image
Relevant logs and/or screenshots
Preparing the "docker" executor
Using Docker executor with image docker:20.10.17 ...
Starting service docker:20.10.17-dind ...
Authenticating with credentials from $DOCKER_AUTH_CONFIG
Pulling docker image docker:20.10.17-dind ...
Using docker image sha256:79f5cf744ab66c48ff532b8dea2662dc90db30faded68ff7b33ce7109578ca7d for docker:20.10.17-dind ...
Waiting for services to be up and running (timeout 30 seconds)..
...
Executing "step_script" stage of the job script
Using docker image sha256:6c5c8b70d0de524ff092921c05ebe9c1b0d05c29962d6717666b29049e52aefe for docker:20.10.17 ...
$ apk add --no-cache git docker-compose
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/aarch64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/aarch64/APKINDEX.tar.gz
...
Build fails due to aarch64/arm64 architecture...
https://docs.gitlab.com/runner/install/osx.html https://docs.gitlab.com/runner/install/docker.html