
如果你使用 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 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
该镜像用于运行https://help.github.com/en/actions/automating-your-workflow-with-github-actions/hosting-your-own-runners%E3%80%82
本项目是https://github.com/myoung34/docker-github-actions-runner%E7%9A%84%E5%88%86%E6%94%AF%E7%89%88%E6%9C%AC%E3%80%82
**本构建版本的差异在于更小的镜像体积和更多https://github.com/derskythe/docker-github-actions-runner/actions**%E3%80%82
!Docker Pulls
此外,本项目提供安全报告。
您可以https://hub.docker.com/r/derskythe/github-runner-base/tags%E6%9F%A5%E7%9C%8B%E5%9F%BA%E7%A1%80%E9%95%9C%E5%83%8F%E7%9A%84%E5%AE%89%E5%85%A8%E6%8A%A5%E5%91%8A%EF%BC%8C%E7%94%B1%E4%BA%8E%E6%9F%90%E4%BA%9B%E5%8E%9F%E5%9B%A0%EF%BC%8C%E9%A2%9D%E5%A4%96%E5%AE%89%E8%A3%85%E7%9A%84%E7%BB%84%E4%BB%B6%E5%8F%AF%E8%83%BD%E5%AD%98%E5%9C%A8%E6%BC%8F%E6%B4%9E%E3%80%82
我们致力于在不过度增加镜像大小的前提下,优化安装新版本软件包。
| 发行版 | 版本 | 最新构建状态 |
|---|---|---|
| Ubuntu | Jammy (22.04) | !Docker Image Version (tag latest semver) |
| Ubuntu | Focal (20.04) | !Docker Image Version (tag latest semver) |
| Ubuntu | Bionic (18.04) | !Docker Image Version (tag latest semver) |
| Debian | Bullseye (11) | !Docker Image Version (tag latest semver) |
| Debian | Sid (10) | !Docker Image Version (tag latest semver) |
X64、ARM64
例如:ubuntu-bionic-2.313.0-31.1
标签由以下部分组成:
ubuntu-bionic - 发行版和版本2.313.0 - https://github.com/actions/runner/releases 版本31.1 - 内部构建编号创建用于自托管运行器的GitHub个人访问令牌(PAT)时,请确保选择以下范围:
- repo(全部)
- admin:org(全部)(组织级运行器必需)
- admin:enterprise(全部)(企业级运行器必需)
- admin:public_key - read:public_key
- admin:repo_hook - read:repo_hook
- admin:org_hook
- notifications
- workflow
以下是Systemd服务定义示例:
shell# 安装方法: # sudo install -m 644 ephemeral-github-actions-runner.service /etc/systemd/system/ # sudo systemctl daemon-reload # sudo systemctl enable ephemeral-github-actions-runner # 启动方法: # sudo systemctl start ephemeral-github-actions-runner # 停止方法: # sudo systemctl stop ephemeral-github-actions-runner # 查看实时日志: # journalctl -f -u ephemeral-github-actions-runner.service --no-hostname --no-tail [Unit] Description=临时GitHub Actions运行器容器 After=docker.service Requires=docker.service [Service] TimeoutStartSec=0 Restart=always ExecStartPre=-/usr/bin/docker stop %N ExecStartPre=-/usr/bin/docker rm %N ExecStartPre=-/usr/bin/docker pull derskythe/github-runner:latest ExecStart=/usr/bin/docker run --rm \ --env-file /etc/ephemeral-github-actions-runner.env \ -e RUNNER_NAME=%H \ -v /var/run/docker.sock:/var/run/docker.sock \ --name %N \ derskythe/github-runner:latest [Install] WantedBy=multi-user.target
对应的环境变量文件示例:
pwsh# sudo install -m 600 ephemeral-github-actions-runner.env /etc/ RUNNER_SCOPE=repo REPO_URL=https://github.com/your-org/your-repo # 组织范围的替代配置: # RUNNER_SCOPE=org # ORG_NAME=your-org LABELS=any-custom-labels-go-here ACCESS_TOKEN=foo-access-token RUNNER_WORKDIR=/tmp/runner/work DISABLE_AUTO_UPDATE=1 EPHEMERAL=1
GitHub托管的运行器是完全临时的。您可以删除其所有数据而不会影响未来的作业。
要在自托管运行器中实现相同的弹性:
EPHEMERAL=1RUNNER_WORKDIR(确保无文件系统持久化)--rm 运行容器(终止后删除容器)本项目默认以 root 用户运行容器。
非root运行是支持的非默认行为,通过环境变量 RUN_AS_ROOT 控制。默认值为 true。
true:保留旧行为,以root运行true 且通过 -u(或任何编排工具等效参数)指定用户:报错并退出false:以root运行容器,并通过gosu切换到 runner 用户false 且通过 -u(或任何编排工具等效参数)指定用户:以指定用户运行整个容器运行器用户为 runner,UID为 1001,GID为 121
如果要以非root用户运行整个容器:
RUN_AS_ROOT 设置为 falseRUNNER_WORKDIR 未提供(默认 /_work)或权限正确。runner 用户无法在入口点脚本中更改其无权访问的目录权限-u runner 或 -u 1001。在k8s中,这对应 securityContext.runAsUser。Nomad等工具配置方式不同。yamlname: 打包 on: release: types: [created] jobs: build: runs-on: self-hosted steps: - uses: actions/checkout@v4 - name: 构建包 run: make all
yamlversion: '2.3' services: worker: image: derskythe/github-runner:latest environment: REPO_URL: https://github.com/example/repo RUNNER_NAME: example-name RUNNER_TOKEN: someGithubTokenHere RUNNER_WORKDIR: /tmp/runner/work RUNNER_GROUP: my-group RUNNER_SCOPE: 'repo' LABELS: linux,x64,gpu security_opt: # SELinux系统需要此选项以允许容器管理其他容器 - label:disable volumes: - '/var/run/docker.sock:/var/run/docker.sock' - '/tmp/runner:/tmp/runner' # 注意:Docker-in-Docker的一个特点是,此路径在主机和容器内必须相同, # Docker管理命令在容器外运行,但期望使用容器内的路径
terraformjob "github_runner" { datacenters = ["home"] type = "system" task "runner" { driver = "docker" env { ACCESS_TOKEN = "footoken" RUNNER_NAME_PREFIX = "myrunner" RUNNER_WORKDIR = "/tmp/github-runner-your-repo" RUNNER_GROUP = "my-group" RUNNER_SCOPE = "org" ORG_NAME = "octokode" LABELS = "my-label,other-label" } config { image = "myoung34/github-runner:latest" privileged = true userns_mode = "host" volumes = [ "/var/run/docker.sock:/var/run/docker.sock", "/tmp/github-runner-your-repo:/tmp/github-runner-your-repo", ] } } }
yamlapiVersion: apps/v1 kind: Deployment metadata: name: actions-runner namespace: runners spec: replicas: 1 selector: matchLabels: app: actions-runner template: metadata: labels: app: actions-runner spec: volumes: - name: dockersock hostPath: path: /var/run/docker.sock - name: workdir hostPath: path: /tmp/github-runner-your-repo containers: - name: runner image: derskythe/github-runner:latest env: - name: ACCESS_TOKEN value: foo-access-token - name: RUNNER_SCOPE value: "org" - name: ORG_NAME value: octokode - name: LABELS value: my-label,other-label - name: RUNNER_TOKEN value: footoken - name: REPO_URL value: https://github.com/your-account/your-repo - name: RUNNER_NAME_PREFIX value: foo - name: RUNNER_NAME valueFrom: fieldRef: fieldPath: metadata.name - name: RUNNER_WORKDIR value: /tmp/github-runner-your-repo - name: RUNNER_GROUP value: my-group volumeMounts: - name: dockersock mountPath: /var/run/docker.sock - name: workdir mountPath: /tmp/github-runner-your-repo
如果提供了 ACCESS_TOKEN(GitHub个人访问令牌),运行器令牌可以在运行时自动获取。这使用https://developer.github.com/v3/actions/self_hosted_runners/#create-a-registration-token%E3%80%82%E4%BE%8B%E5%A6%82%EF%BC%9A
pwshdocker 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 RUNNER_SCOPE="org" \ -e ORG_NAME="octokode" \ -e LABELS="my-label,other-label" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/github-runner-your-repo:/tmp/github-runner-your-repo \ derskythe/github-runner:latest
pwshdocker 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 RUNNER_SCOPE="enterprise" \ -e ENTERPRISE_NAME="my-enterprise" \ -e LABELS="my-label,other-label" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/github-runner-your-repo:/tmp/github-runner-your-repo \ derskythe/github-runner:latest
pwshdocker 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 RUNNER_SCOPE="org" \ -e DISABLE_AUTO_UPDATE="true" \ -e ORG_NAME="octokode" \ -e LABELS="my-label,other-label" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/github-runner-your-repo:/tmp/github-runner-your-repo \ derskythe/github-runner:latest
pwshdocker run -d --restart always --name github-runner \ -e REPO_URL="https://github.com/username/repo" \ -e RUNNER_NAME="foo-runner" \ -e RUNNER_TOKEN="footoken" \ -e RUNNER_WORKDIR="/tmp/github-runner-your-repo" \ -e RUNNER_GROUP="my-group" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/github-runner-your-repo:/tmp/github-runner-your-repo \ derskythe/github-runner:latest
pwshfunction 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" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/github-runner-${repo}:/tmp/github-runner-${repo} \ --name $name derskythe/github-runner:latest } github-runner your-account/your-repo AARGHTHISISYOURGHACTIONSTOKEN github-runner your-account/some-other-repo ARGHANOTHERGITHUBACTIONSTOKEN ubuntu-focal
此方法可应用于所有其他部署方式
pwsh# 仓库级运行器 docker run -d --restart always --name github-runner \ -e REPO_URL="https://github.com/username/repo" \ -e RUNNER_NAME="foo-runner" \ -e RUNNER_TOKEN="footoken" \ -e RUNNER_WORKDIR="/tmp/github-runner-your-repo" \ -e RUNNER_GROUP="my-group" \ -e CONFIGURED_ACTIONS_RUNNER_FILES_DIR="/actions-runner-files" \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /tmp/github-runner-your-repo:/tmp/github-runner-your-repo \ -v /tmp/foo:/actions-runner-files \ derskythe/github-runner:latest
要在代理服务器后运行GitHub运行器,需要将GitHub运行器https://docs.github.com/en/actions/hosting-your-own-runners/using-a-proxy-server-with-self-hosted-runners%E4%BD%9C%E4%B8%BA%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E4%BC%A0%E9%80%92
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
来自真实用户的反馈,见证轩辕镜像的优质服务