几个月前配置过,因为迁移虚拟机,备忘

1. 创建容器

1
docker run -d --name gitlab-runner-12.10.1 --restart always -v /gitlab-runner/config/:/etc/gitlab-runner/  -v /var/run/docker.sock:/var/run/docker.sock  gitlab/gitlab-runner:latest

2. 进入容器配置连接到gitlab

1
2
docker exec -it 4054 /bin/bash  #4054为容器ID
gitlab-runner register -n --url=http://mygitlabUrl --registration-token=gitlab-token --executor=docker --description="vm-199-06" --docker-image="docker:19.03.8" --docker-volumes /var/run/docker.sock:/var/run/docker.sock --locked=false