下载镜像并启动

docker run -d –name gitlab-runner –restart always -v /home/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 bash

执行以下命令,注册gitlab-runner

修改配置文件

vim /home/gitlab-runner/config/config.toml

volumes = [“/cache”,”/var/run/docker.sock:/var/run/docker.sock”]

docker restart gitlab-runner