
该镜像用于运行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
!https://img.shields.io/docker/pulls/derskythe/github-runner?style=plastic&logo=docker&cacheSeconds=64000&link=https%3A%2F%2Fhub.docker.com%2Frepository%2Fdocker%2Fderskythe%2Fgithub-runner
此外,本项目提供安全报告。
您可以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
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。




探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
docker search 限制
站内搜不到镜像
离线 save/load
插件要用 plugin install
WSL 拉取慢
安全与 digest
新手拉取配置
镜像合规机制
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
域名连通性排查
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务