Last active
October 20, 2025 15:34
-
-
Save kalw/fd1570016262debdf6476ea07b58cfe2 to your computer and use it in GitHub Desktop.
gitlab et runner docker compose
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services: | |
| gitlab: | |
| image: gitlab/gitlab-ee:latest | |
| restart: always | |
| ports: | |
| - "24:22" | |
| - "80:80" | |
| - "443:443" | |
| volumes: | |
| - gitlab-data:/var/opt/gitlab | |
| - gitlab-logs:/var/log/gitlab | |
| - gitlab-config:/etc/gitlab | |
| environment: | |
| GITLAB_OMNIBUS_CONFIG: | | |
| external_url 'http://gitlab.127.0.0.1.nip.io/'; | |
| gitlab_rails['lfs_enabled'] = true; | |
| gitlab_rails['initial_shared_runners_registration_token'] = "${RUNNER_TOKEN}" | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost/-/health"] | |
| interval: 1m30s | |
| timeout: 10s | |
| retries: 3 | |
| start_period: 40s | |
| start_interval: 5s | |
| runner: | |
| image: gitlab/gitlab-runner:ubuntu | |
| restart: always | |
| depends_on: | |
| gitlab: | |
| condition: service_healthy | |
| volumes: | |
| - /var/run/docker.sock:/var/run/docker.sock | |
| external_links: | |
| - gitlab:gitlab.127.0.0.1.nip.io | |
| entrypoint: /bin/sh -c "((gitlab-runner list |grep $$(hostname) )|| gitlab-runner register --leave-runner --non-interactive --name $$(hostname) --url 'http://gitlab/' --registration-token ${RUNNER_TOKEN} --executor "docker" --docker-image alpine:latest --tag-list docker --docker-privileged=false --run-untagged=true --docker-links='gitlab:gitlab.127.0.0.1.nip.io' --locked='false'; exit)&& gitlab-runner run" | |
| volumes: | |
| gitlab-data: | |
| gitlab-logs: | |
| gitlab-config: |
Author
- RUNNER_TOKEN="$(openssl rand 32 -base64)" docker-compose -f gitlab-ee.yaml up -d
+ RUNNER_TOKEN="$(openssl rand -base64 32)" docker-compose -f gitlab-ee.yaml up -d
docker-compose -f gitlab-ee.yaml exec gitlab bash -c "grep -e ^Password /etc/gitlab/initial_root_password"The rand command requires the number of bytes after the options : https://docs.openssl.org/1.0.2/man1/rand/
Author
🙏
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
export RUNNER_TOKEN="$(openssl rand -base64 32)" # generate runner registration token
docker-compose -f gitlab-ee.yaml up -d # start the instance and the runner
docker-compose -f gitlab-ee.yaml exec gitlab bash -c "grep -e ^Password /etc/gitlab/initial_root_password" # get initial root passwd
docker-compose -f gitlab-ee.yaml down -v && docker-compose -f gitlab-ee.yaml up -d # restart fresh