Ubuntu 22.04 Docker image for running a GitHub Actions self-hosted runner.
| File | Description |
|---|---|
Dockerfile |
Ubuntu 22.04 image with runner v2.331.0 pre-installed |
entrypoint.sh |
Configures and starts the runner at container startup |
cd runner
docker build -t gh-runner .Pass the registration token at runtime — never bake it into the image.
docker run -d \
--name gh-runner-REPO \
--restart unless-stopped \
-e RUNNER_TOKEN=<your-token> \
gh-runner| Variable | Default | Required | Description |
|---|---|---|---|
RUNNER_TOKEN |
— | Yes | GitHub registration token |
RUNNER_URL |
https://github.com/XXXX/XXXX |
No | Repository or organization URL |
RUNNER_NAME |
hostname | No | Display name shown in GitHub |
RUNNER_LABELS |
self-hosted |
No | Comma-separated runner labels |
Tokens expire after 1 hour. Generate one using either method:
GitHub UI: Settings → Actions → Runners → New self-hosted runner
GitHub CLI:
gh api repos/organization/repo/actions/runners/registration-token \
--method POST \
--jq .tokenjobs:
build:
runs-on: self-hostedThe runner de-registers itself from GitHub automatically when the container stops.
docker stop gh-runner
docker rm gh-runner