GitLab Runner 安装
docker-compose.yml
version: '3'
services:
gitlab-runner:
container_name: docker_gitlab-runner
image: gitlab/gitlab-runner
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./config:/etc/gitlab-runner
restart: always
执行命令
docker-compose up --force-recreate --build -d
注册runner
docker exec -it docker_gitlab-runner gitlab-ci-multi-runner register
#Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
[gitlab-ci 地址]
#Please enter the gitlab-ci token for this runner:
[gitlab-ci token]
#Please enter the gitlab-ci description for this runner:
[cb7d680e0af0]: [描述]
#Please enter the gitlab-ci tags for this runner (comma separated):
[tag]
#Registering runner... succeeded
#Please enter the executor: custom, shell, kubernetes, docker, docker-ssh, parallels, ssh, virtualbox, docker+machine, docker-ssh+machine:
shell
#Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
问题
Got permission denied while trying to connect to the Docker
描述:这是没有权限执行
解决:
# 授权
sudo chmod a+rw /var/run/docker.sock
# 生成容器
docker-compose up --force-recreate --build -d