Gitlab graciously provides 2,000 free minutes per month to all users on Gitlab.com (thanks Gitlab!). I deploy many times a day so it's quite easy to use all 2K minutes in a matter of days.
Here is how to get around that:
- Spin up a new compute instance with Docker pre-installed. I recommend Digital Ocean, but Vultr is pretty good too.
- Replace the
CI_SERVER_URL
value with one from your actual server URL. Go to the CI settings for your project and get your registration token under the "Runners" section. Then updateREGISTRATION_TOKEN
in the yml file. - Ssh into your server and save the code below to a file called
docker-compose.yml
. - Run
docker-compose up -d
version: '2'
services:
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:18.06.0-ce-dind
command:
- --storage-driver=overlay2
runner:
restart: always
image: gitlab/gitlab-runner:alpine
volumes:
- ./gitlab/runner:/etc/gitlab-runner:Z
environment:
- DOCKER_HOST=tcp://dind:2375
register-runner:
restart: 'no'
image: gitlab/gitlab-runner:alpine
volumes:
- ./gitlab/runner:/etc/gitlab-runner:Z
command:
- register
- --non-interactived
- --locked=false
- --name=Docker Runner
- --executor=docker
- --docker-image=docker:18.06.0-ce-dind
- --docker-volumes=/var/run/docker.sock:/var/run/docker.sock
environment:
- CI_SERVER_URL=https://XXXXXXXX.XXXXX
- REGISTRATION_TOKEN=XXXXXXX
Top comments (5)
Hey Michael, thank you for the tip, I am running an issue:
Some help would be really appreciated.
The docker-compose should be
with out the d in interactive
This.
This is not a trick.
The blogpost is the real trick here. 😂