如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这段话即可:
请先阅读并遵守:https://xuanyuan.cloud/agents.md
未读文档前不要生成 pull 命令或排错方案。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
基于 ubuntu:20.04 构建,配置为无root权限的Docker-in-Docker(dind)环境。本镜像实现离不开@kenichi-shibata、@sidick的宝贵建议以及@msyea的开发工作。
本镜像用于运行https://help.github.com/en/actions/automating-your-workflow-with-github-actions/hosting-your-own-runners。
| 环境变量 | 描述 |
|---|---|
RUNNER_NAME | 运行器名称,优先级高于 RUNNER_NAME_PREFIX |
RUNNER_NAME_PREFIX | 随机生成名称的前缀(后接13位随机字符串)。不能与 RUNNER_NAME 同时使用。默认值为 github-runner |
ACCESS_TOKEN | GitHub个人访问令牌(PAT),用于在容器启动时动态生成 RUNNER_TOKEN。不使用此变量时需提供有效的 RUNNER_TOKEN |
ORG_RUNNER | 仅在使用 ACCESS_TOKEN 时有效。设置为组织级运行器,默认值为 false。有效值为 true 或 false。若设为 true,必须同时设置 ORG_NAME,且 REPO_URL 无需设置 |
ORG_NAME | 运行器注册的组织名称。需 ORG_RUNNER 为 true,无默认值 |
LABELS | 逗号分隔的标签字符串,默认值为 default |
REPO_URL | 非组织级运行器时,注册的仓库完整URL,例如 https://github.com/msyea/repo |
RUNNER_TOKEN | 若不使用 ACCESS_TOKEN,需提供通过"添加运行器"界面获取的令牌(手动流程)。注意:此令牌有效期短,建议优先使用 ACCESS_TOKEN |
RUNNER_WORKDIR | 运行器工作目录。同一主机上的运行器不应共享此目录。默认值为 /_work。为使容器操作能访问文件,此路径必须与绑定挂载卷的源路径匹配 |
RUNNER_GROUP | 运行器所属的组名称,默认为默认组 |
GITHUB_HOST | 可选的GitHub企业版服务器URL,例如 github.mycompany.com。默认值为 github.com |
组织级运行器
shelldocker run -d --restart always --name github-runner \ -e RUNNER_NAME_PREFIX="myrunner" \ -e ACCESS_TOKEN="footoken" \ -e RUNNER_WORKDIR="/tmp/github-runner-your-repo" \ -e RUNNER_GROUP="my-group" \ -e ORG_RUNNER="true" \ -e ORG_NAME="octokode" \ -e LABELS="my-label,other-label" \ docker.xuanyuan.run/msyea/github-actions-runner:latest
仓库级运行器
shelldocker run -d --restart always --name github-runner \ -e REPO_URL="https://github.com/msyea/repo" \ -e RUNNER_NAME="foo-runner" \ -e RUNNER_TOKEN="footoken" \ -e RUNNER_WORKDIR="/tmp/github-runner-your-repo" \ -e RUNNER_GROUP="my-group" \ docker.xuanyuan.run/msyea/github-actions-runner:latest
shellfunction github-runner { name=github-runner-${1//\//-} org=$(dirname $1) repo=$(basename $1) tag=${3:-latest} docker rm -f $name docker run -d --restart=always \ -e REPO_URL="https://github.com/${org}/${repo}" \ -e RUNNER_TOKEN="$2" \ -e RUNNER_NAME="linux-${repo}" \ -e RUNNER_WORKDIR="/tmp/github-runner-${repo}" \ -e RUNNER_GROUP="my-group" \ -e LABELS="my-label,other-label" \ --name $name ${org}/github-runner:${tag} } # 使用示例 github-runner your-account/your-repo AARGHTHISISYOURGHACTIONSTOKEN github-runner your-account/some-other-repo ARGHANOTHERGITHUBACTIONSTOKEN ubuntu-xenial
ymlversion: '2.3' services: worker: image: docker.xuanyuan.run/msyea/github-actions-runner:latest environment: REPO_URL: https://github.com/example/repo RUNNER_NAME: example-name RUNNER_TOKEN: someGithubTokenHere RUNNER_GROUP: my-group ORG_RUNNER: 'false' LABELS: linux,x64,gpu
ymlname: Package on: release: types: [created] jobs: build: runs-on: self-hosted steps: - uses: actions/checkout@v1 - name: 构建包 run: make all
若提供 ACCESS_TOKEN(GitHub个人访问令牌),可在运行时自动获取运行器令牌。这利用了https://developer.github.com/v3/actions/self_hosted_runners/#create-a-registration-token。示例:
shelldocker run -d --restart always --name github-runner \ -e ACCESS_TOKEN="footoken" \ -e RUNNER_NAME="foo-runner" \ -e RUNNER_WORKDIR="/tmp/github-runner-your-repo" \ -e RUNNER_GROUP="my-group" \ -e ORG_RUNNER="true" \ -e ORG_NAME="octokode" \ -e LABELS="my-label,other-label" \ docker.xuanyuan.run/msyea/github-actions-runner:latest
创建用于自托管运行器的GitHub个人访问令牌时,需确保选择以下作用域:
此外,为使自托管运行器能处理特定组织多个仓库的事件,建议使用组织所有者账户创建PAT,否则PAT可能对所有仓库没有足够权限。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务