Skip to content

docker executor: add platform to image and services configuration

Description

Apple introduced Apple Silicon or M1 based on ARM64 V8 architecture a while ago, and developers love it. When I tried to use M1 as GitLab Runner (using Rosetta 2) it's failing to start a docker container with warning like below.

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

Or with just

docker run -d postgis/postgis

But docker cli has --platform argument which you can specify platform for an image, then below command starts a container.

docker run --platform linux/amd64  -d postgis/postgis

Proposal

Make is possible to specify platform for image and services configuration. For example,

image:
  name: postgis/postgis
  platform: linux/amd64
services:
  - name: postgis/postgis
    platform: linux/amd64

Links to related issues and merge requests / references

Edited by Dulmandakh