Skip to content

Instantly share code, notes, and snippets.

@czende
Created September 11, 2019 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save czende/5c32069d06f0e1c85d1b44f2827971ae to your computer and use it in GitHub Desktop.
Save czende/5c32069d06f0e1c85d1b44f2827971ae to your computer and use it in GitHub Desktop.
GitLab with runner via docker-compose
version: '3.7'
services:
gitlab-web:
image: gitlab/gitlab-ce:latest
container_name: gitlab-web
hostname: gitlab-web
volumes:
- './gitlab-config:/etc/gitlab'
- './gitlab-logs:/var/log/gitlab'
- './gitlab-data:/var/opt/gitlab'
ports:
- '2222:22'
- '81:80'
- '443:443'
- '4567:4567'
environment:
GITLAB_OMNIBUS_CONFIG: |
gitlab_rails['gitlab_shell_ssh_port'] = 2222
registry_external_url 'http://localhost:4567'
registry['enable'] = true
unicorn['socket'] = '/opt/gitlab/var/unicorn/gitlab.socket'
networks:
- gitlab-network
gitlab-runners:
image: gitlab/gitlab-runner:latest
container_name: gitlab-runners
hostname: gitlab-runners
volumes:
- './gitlab-runners-config:/etc/gitlab-runner:Z'
- '/var/run/docker.sock:/var/run/docker.sock'
networks:
- gitlab-network
networks:
gitlab-network:
name: gitlab-network
#!/bin/sh
# Get the registration token from:
# http://localhost:81/admin/runners
registration_token=XXXXXXXXXXXXXXX
docker exec -it gitlab-runners \
gitlab-runner register \
--non-interactive \
--registration-token ${registration_token} \
--locked=false \
--description docker-stable \
--url http://gitlab-web \
--executor docker \
--docker-image docker:stable \
--docker-volumes "/var/run/docker.sock:/var/run/docker.sock" \
--docker-network-mode gitlab-network \
--docker-privileged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment