Docker部署gitlab-runner
启动 GitLab Runner 容器
docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
注册 GitLab Runner
docker exec -it gitlab-runner gitlab-runner register
# 进入docker容器内
docker exec -it 0898 bash
# 注册 GitLab Runner
gitlab-runner register
# 输入您的 GitLab 服务器 URL
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
https://gitlab.example.com/
# 输入您的 GitLab runner 令牌
Please enter the gitlab-ci token for this runner:
runner_token
# 输入您的 runner 名称
Please enter the gitlab-ci description for this runner:
runner_name
# 选择您的执行器类型(这里是 docker)
Please enter the gitlab-ci tags for this runner (comma separated):
docker
# 选择 Docker 镜像
Please enter the executor: docker-ssh, docker, ssh, parallels, virtualbox, kubernetes, docker+machine, docker-ssh+machine, shell:
docker
# 输入 Docker 镜像名称
Please enter the Docker image (eg. ruby:2.1):
alpine:3.12
# 退出容器
exit
重启 GitLab Runner
需要重启 GitLab Runner,以使配置生效
docker restart gitlab-runner
此处评论已关闭