Edg*_*rka 10 gitlab docker gitlab-ci-runner
我正在运行容器gitlab。
我还尝试gitlab runner通过本文进行 dockerized 设置。
首先我尝试通过以下方式运行 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
Run Code Online (Sandbox Code Playgroud)
日志说:
...
Listen address not defined, session server disabled builds=0
ERROR: Failed to load config stat /etc/gitlab-runner/config.toml: no such file or directory builds=0
ERROR: Failed to load config stat /etc/gitlab-runner/config.toml: no such file or directory builds=0
...
Run Code Online (Sandbox Code Playgroud)
我还尝试通过这篇文章注册跑步者:
docker run --rm -t -i -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register
Run Code Online (Sandbox Code Playgroud)
5步后:
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag
Run Code Online (Sandbox Code Playgroud)
我收到错误:
ERROR: Registering runner... failed runner=KuwydETA status=couldn't execute POST against http://localhost/api/v4/runners: Post http://localhost/api/v4/runners: dial tcp 127.0.0.1:80: getsockopt: connection refused
PANIC: Failed to register this runner. Perhaps you are having network problems
Run Code Online (Sandbox Code Playgroud)
小智 3
在/srv/gitlab-runner/config您需要插入config.toml文件的目录中。
您可以在以下位置找到注册令牌:
https://{your_gitlab_host}/project_namespace/project_name/runners
Run Code Online (Sandbox Code Playgroud)
使用以下内容作为模板创建临时配置文件:
$ cat > /tmp/test-config.template.toml << EOF
[[runners]]
[runners.docker]
[[runners.docker.services]]
name = "mysql:latest"
[[runners.docker.services]]
name = "redis:latest"
EOF
Run Code Online (Sandbox Code Playgroud)
您现在可以使用刚刚创建的配置文件注册运行器:
gitlab-runner register \
--non-interactive \
--url "https://gitlab.com" \
--registration-token "$REGISTRATION_TOKEN" \
--template-config /tmp/test-config.template.toml \
--description "gitlab-ce-ruby-2.7" \
--executor "docker" \
--docker-image ruby:2.7
Run Code Online (Sandbox Code Playgroud)
来源: https: //docs.gitlab.com/runner/examples/gitlab.html
https://docs.gitlab.com/runner/configuration/advanced-configuration.html
| 归档时间: |
|
| 查看次数: |
9177 次 |
| 最近记录: |