DEV Community

Tomasz Szuster
Tomasz Szuster

Posted on • Updated on

GitLab runner on MacBook with docker-compose

It turned out that running a self-hosted Gitlab runner on a MacBook with docker desktop and docker-compose was not so common approach.

Below are code snippets that enable that solution

  • docker-compose.yaml
version: '3'
services:

 gitlab-runner:
  image: gitlab/gitlab-runner:alpine
  restart: always
  container_name: gitlab-runner
  hostname: gitlab-runner
  volumes:
   - /Users/gitlab-runner:/etc/gitlab-runner
   - /var/run/docker.sock:/var/run/docker.sock
  environment:
    - DOCKER_HOST=unix:///var/run/docker.sock
  networks:
      - gitlab-network

networks:
  gitlab-network:
    name: gitlab-network
Enter fullscreen mode Exit fullscreen mode
  • runner configuration config.yaml
concurrent = 2
check_interval = 0
shutdown_timeout = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "docker-stable"
  url = "https://gitlab.com"
  id = 112233
  token = "112233"
  token_obtained_at = 1111-01-24T21:09:11Z
  token_expires_at = 0001-01-01T00:00:00Z
  executor = "docker"
  [runners.cache]
    MaxUploadedArchiveSize = 0
  [runners.docker]
    tls_verify = false
    image = "docker:stable"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
    network_mode = "host"
    shm_size = 0
    network_mtu = 0

Enter fullscreen mode Exit fullscreen mode

Top comments (0)