
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Dockerfile https://github.com/ci-and-cd/docker-gitlab-runner
https://hub.docker.com/r/cirepo/gitlab-runner/
docker run --privileged=true --rm -v /var/run/docker.sock:/var/run/docker.sock busybox chmod a+rw /var/run/docker.sock docker run --privileged=true --rm -v /var/run/docker.sock:/var/run/docker.sock busybox ls -l /var/run/docker.sock
Run docker-compose up -d
Find token for runner.
Shared: Goto admin/runners page (e.g. http(s)://gitlab:/admin/runners).
Specific: Goto repo's settings/ci_cd page (e.g. http(s)://gitlab:/
Run docker exec -it gitlab-runner sudo gitlab-runner register and input following info (in <>).
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/): <e.g. http://gitlab:10080/> Please enter the gitlab-ci token for this runner: <Token found in step 4> Please enter the gitlab-ci description for this runner: <gitlab-runner-<ip>> Please enter the gitlab-ci tags for this runner (comma separated): <gitlab-runner> Whether to run untagged builds [true/false]: <true> Whether to lock Runner to current project [true/false]: <false> Registering runner... succeeded runner=******** Please enter the executor: parallels, virtualbox, shell, ssh, docker+machine, docker-ssh+machine, kubernetes, docker, docker-ssh: <shell> Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
It seems most recent version of gitlab-runner's build process can't see host's environment variables such as JAVA_HOME or CI_INFRA_OPT_GIT_AUTH_TOKEN (e.g. gitlab: http(s)://gitlab/profile/personal_access_tokens). You can add environment variables at Repository->Settings->CI/CD Pipelines->Secret Variables.
ERROR: 403 If https access of git repository on gitlab is disabled Cloning repository... Cloning into '/var/lib/gitlab-runner/builds/b3ef1983/0/contextPath/group/repository'... remote: Git access over HTTP is not allowed fatal: unable to access '[***] The requested URL returned error: 403 ERROR: Job failed: exit status 1
see: https://gitlab.com/gitlab-org/gitlab-ce/issues/22501
Copy ssh key into container
bashdocker exec gitlab-runner sh -c "echo HOME \$HOME" docker exec gitlab-runner sh -c "ls -la ~/.ssh; cat ~/.ssh/config" docker cp ~/.ssh/id_rsa gitlab-runner:/var/lib/gitlab-runner/.ssh/id_rsa docker exec gitlab-runner sh -c "sudo chown 1000:1000 ~/.ssh/id_rsa; ls -la ~/.ssh"
Clone manually
in project's .gitlab-ci.yml
yamlbefore_script: - export GIT_STRATEGY=none
Do git fetch in scripts of .gitlab-ci.yml
gitlab-runner's version must compatible with gitlab service.
Container instance needs to access docker (/var/run/docker.sock) on host. On host
docker run --privileged=true --rm -v /var/run/docker.sock:/var/run/docker.sock busybox chmod a+rw /var/run/docker.sock docker run --privileged=true --rm -v /var/run/docker.sock:/var/run/docker.sock busybox ls -l /var/run/docker.sock
Or in container
sudo chmod a+rw /var/run/docker.sock
docker exec -it gitlab-runner cat /etc/gitlab-runner/config.toml docker exec -it gitlab-runner cat /var/lib/gitlab-runner/.gitlab-runner/config.toml docker exec -it gitlab-runner cat /var/lib/gitlab-runner/.ssh/config docker exec -it gitlab-runner ls -la /var/lib/gitlab-runner/.ssh docker exec -it gitlab-runner ls -la /var/lib/gitlab-runner/.docker
https://gitlab.com/gitlab-org/gitlab-ce/issues/20612
export CI_INFRA_OPT_GIT_AUTH_TOKEN=<your_CI_INFRA_OPT_GIT_AUTH_TOKEN>sed "s#<PUT_BASE64_CI_INFRA_OPT_GIT_AUTH_TOKEN_HERE_MANUALLY>#$(echo -n ${CI_INFRA_OPT_GIT_AUTH_TOKEN} | base64 -w 0)#" gitlab-runner-secret.template > gitlab-runner-secret.yamlkubectl cluster-info check that kubectl is properly configuredkubectl create -f gitlab-runner-secret.yaml and kubectl create -f gitlab-runner-deploy.yaml to deploykubectl get po to see gitlab-runner's podkubectl exec -it gitlab-runner-<suffix> bash to get in gitlab-runner's podchown -R 1000:1000 /var/lib/gitlab-runner to ensure directory's permissionkubectl exec -it gitlab-runner-<suffix> gitlab-runner register
and input same info as previous section (Start and register a runner on raw machine)Use CONFIG_FILE environment variable specify a configuration file.
https://docs.gitlab.com/runner/configuration/advanced-configuration.html
# e.g. set concurrent to 3 docker exec -it gitlab-runner /bin/sed -Ei 's#^concurrent = [0-9]+$#concurrent = 3#g' /etc/gitlab-runner/config.toml
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务
以下是 cirepo/gitlab-runner 相关的常用 Docker 镜像,适用于 不同场景 等不同场景: