A GitHub Actions runner is the program that runs your GitHub workflow jobs: checking out code, building, testing, creating Docker images, or deploying to a server. Normally, these jobs run on GitHub's servers. With a self-hosted runner, they run on your own VPS. The runner has no web interface of its own. It signs in to GitHub, waits there for jobs, and appears under Runners in your repository or organization settings.
The One-Click App installs the myoung34/github-runner Docker image. In this guide, we'll show you two ways to set it up: the easy way as a One-Click App and the manual installation with Docker Compose. Both methods require an access token from GitHub that the runner uses to register itself. Then you'll send your first workflow to the runner and learn what to keep in mind for security.
GitHub-hosted runners are sufficient for many projects. A dedicated runner on a VPS is worthwhile if:
- You don't have enough Actions minutes. Jobs on self-hosted runners don't count against your GitHub account's Actions minutes quota.
- Your builds benefit from a cache. The runner retains dependencies, Docker layers, and working files between jobs. This often makes repeated builds significantly faster.
- The job needs access to your server. A deployment job can start containers directly on the VPS or access services that are only available internally, without you having to open a port to the outside.
- You need specific tools and versions. On your runner, you decide which software is installed and how much CPU and RAM a build gets.
A dedicated runner is less suitable for public repositories. Anyone can submit code through a pull request, and your runner will then run it on your server. A Linux VPS is also not the right place for jobs that need macOS, Windows, or a graphics card.
You can register a runner for a single repository or for an entire organization. You set this during installation with RUNNER_SCOPE:
| Repository runner | Organization runner | |
|---|---|---|
RUNNER_SCOPE | repo (default) | org |
| Required value | REPO_URL, e.g. https://github.com/YOUR-NAME/YOUR-REPO | ORG_NAME, e.g. your-organization |
| Available to | This repository only | All organization repositories that you enable in GitHub |
| Token permission (fine-grained token) | Repository permission Administration: Read and write | Organization permission Self-hosted runners: Read and write |
| Token permission (classic token) | repo | admin:org |
| Suitable for | Your own projects, one team, one repository | Multiple repositories with a shared build environment |
We recommend starting with a repository runner. It's quick to set up, and the token only needs access to a single repository. A personal account without an organization can only use repository runners.
The quickest way to set up your own runner is through your VPS's One-Click Apps. Enter your repository address and a token; the container takes care of the rest when it starts.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Set up One-Click Apps for instructions.
- A GitHub repository where you have admin permissions, or an organization where you're an owner. Use a private repository; see “Security: private repositories only.”
- The runner itself needs 256 MB of RAM, but plan for at least 2 GB of RAM and 20 GB of storage for actual builds. The image alone takes up just under 4 GB when extracted, in addition to caches and Docker images from your builds.
The runner registers itself with GitHub every time it starts. To do this, it needs a personal access token. The runner uses this token to get the actual registration token from GitHub, which is valid for only one hour. We recommend a fine-grained token that can access just one repository:
- Sign in to GitHub and open your profile picture in the top right > Settings > Developer settings > Personal access tokens > Fine-grained tokens.
- Click Generate new token, enter a name such as
runner-vps, and choose an Expiration date. - Under Resource owner, select your account or the organization that owns the repository.
- Set Repository access to Only select repositories and choose the repository for the runner.
- Under Permissions, set Administration to Read and write. The runner doesn't need any other permissions.
- Click Generate token and copy the token immediately. GitHub only displays it once.
For an organization runner, select the organization under Resource owner, then set Self-hosted runners to Read and write under Organization permissions. A classic token (Tokens (classic)) also works. It needs the repo or admin:org scope, but applies to all repositories your account can access.
The Administration permission allows the token to change repository settings. Therefore, give it access to only that one repository, set an expiration date, and don't share it with anyone. If it expires, the runner won't be able to register after its next restart.
- Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
- Search for Github Runner in the app catalog and click Install app.
- Under App name, enter a name that will help you recognize the runner. This app doesn't have a domain because the runner has no web interface and doesn't open a port.
- Expand App configuration and enter the values from the table below.
ACCESS_TOKENandREPO_URLare required (orORG_NAMEfor an organization runner). The runner won't start without them, even if the form marks all fields as optional. - Click Queue installation.
| Field | Description | Example |
|---|---|---|
REPO_URL | Full repository address; required when RUNNER_SCOPE = repo | https://github.com/YOUR-NAME/YOUR-REPO |
ACCESS_TOKEN | Your GitHub token; required | github_pat_... |
RUNNER_SCOPE | repo for a repository, org for an organization | repo |
ORG_NAME | Organization name; only for RUNNER_SCOPE = org | your-organization |
LABELS | Custom runner labels, separated by commas | vps,docker |
RUNNER_NAME_PREFIX | Prefix for the runner name in GitHub | coolify-runner |
RUNNER_NAME_SUFFIX | Has no effect with the image being used; leave the default value | false |
The first image download takes a few minutes and is around 1.7 GB. The container then starts and registers with GitHub. Since the runner has no web interface, the app card won't show an Access link.
You can see whether everything worked in GitHub, not in the panel:
- Open your repository on GitHub and click Settings > Actions > Runners. For an organization, find the list in the organization's settings under Actions > Runners.
- A runner named
coolify-runner-followed by a random suffix will appear there. The Idle status means the runner is connected and waiting for jobs. - Click the runner to see its labels:
self-hosted,Linux,X64, and your custom labels fromLABELS.
In the panel, open the runner's output using the Logs icon on the app card. After successful registration, the last line should say Listening for Jobs. If the runner doesn't appear in GitHub, see “If the runner won't start.”
When stopped, the runner signs out of GitHub. The next time it starts, it signs in again with a new random name. This is normal. If the container is stopped abruptly, for example because the VPS crashes, the old entry remains as Offline. You can remove it in GitHub under Runners by opening the runner's menu and selecting Remove.
A workflow uses your runner when runs-on includes the self-hosted label. Create the file .github/workflows/runner-test.yml in your repository:
name: Runner-Test
on:
workflow_dispatch:
jobs:
test:
runs-on: [self-hosted, default]
steps:
- uses: actions/checkout@v5
- run: uname -a
- run: docker version
On GitHub, start the workflow from the Actions tab by clicking Run workflow. The job will now run on your VPS, and its status in the Runners list will briefly change to Active. The default label comes from the default value of LABELS. If you set custom labels there, use those instead.
A runner executes any code a workflow sends it. This leads to two rules:
- Only use the runner for private repositories you trust. In a public repository, anyone can open a pull request with a modified workflow, and your runner will execute that code on your server. GitHub itself advises against using self-hosted runners for public repositories.
- A job has full control over your VPS. The One-Click App passes the server's Docker socket (
/var/run/docker.sock) to the runner so your workflows can build Docker images and start containers. Anyone who can control Docker on the server can also read, stop, or delete all other containers and effectively has root privileges. Your token is also accessible to a job.
For repositories that other people contribute to, go to Settings > Actions > General in GitHub and require approval for workflows from forks. It's best to run the runner on a VPS that doesn't host any other important services.
The runner program keeps itself up to date. When a new version is released, the runner downloads it and restarts. GitHub requires this: runners that are more than 63 days behind the current version no longer receive jobs. To apply new templates from the app catalog, open the app settings (gear icon), go to App update, and click Check for updates and Apply update. If it says the app is up to date, there is no newer template.
There isn't much to back up. The runner renews its registration itself every time it starts. The app's data volume only contains working files and caches from your jobs. The important things are to keep your workflows in the repository and your token in your password manager.
If your token expires or you want to replace it, create a new one in GitHub, open the App environment tab using the gear icon on the app card, enter it under App configuration in ACCESS_TOKEN, and click Save. The panel only shows the token in masked form there. The app then restarts and registers with the new token. You can change REPO_URL, LABELS, or the other values the same way later.
If a value is missing or the token is invalid, the runner exits on startup and the container automatically restarts shortly afterward. The app card then shows Failed or Degraded, along with a note to check the logs and settings. The cause is shown in the app card's Logs. Over SSH, you can view the same output with these two commands:
docker ps -a --format '{{.Names}}' | grep '^runner-'
docker logs --tail 50 runner-ID
Replace runner-ID with the name from the first line. These are the most common messages and what they mean:
| Message in the logs | Cause | Solution |
|---|---|---|
REPO_URL required for repo runners, followed by Invalid configuration provided for url | REPO_URL is empty | Enter the full repository address |
ORG_NAME required for org runners | RUNNER_SCOPE is set to org, but ORG_NAME is missing | Enter the organization name |
Invalid configuration provided for token, preceded by curl: (22) The requested URL returned error: 401 for an invalid token | ACCESS_TOKEN is empty, was copied incorrectly, or has expired | Create and enter a new token |
curl: (22) The requested URL returned error: 403 or 404 | The token doesn't have admin permissions for this repository, or REPO_URL is misspelled | Check the token permissions and the address spelling |
Correct the value under App environment and click Save. The app restarts with the new values. Your token won't appear in these messages.
The rest of this guide describes the manual installation of the runner with Docker Compose on your VPS, for example if you don't use One-Click Apps on the server or need settings that aren't available in the form. We'll use the same image as the One-Click App, but at a fixed version.
- A Linux VPS running Debian or Ubuntu, with SSH access; see First SSH connection.
- Docker and Docker Compose (Compose v2); see Install Docker. Check the installation with
docker --versionanddocker compose version. - A GitHub token as described above under “Create a token in GitHub.”
The values below are for a runner handling typical builds. The image alone takes up just under 4 GB when extracted. Large projects, concurrent containers, or extensive Docker images need more.
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU core | 2 vCPU cores |
| RAM | 256 MB | 2 GB |
| Storage | 8 GB | 20 GB |
The runner establishes its own connection to GitHub over outbound HTTPS (port 443). It doesn't need an open port. With ufw, you only need to allow SSH:
ufw allow OpenSSH
ufw enable
If other services are running on the VPS, allow their ports as well. For more information about the firewall, see Firewall management on Linux.
Create a directory for the runner:
mkdir -p /opt/github-runner
cd /opt/github-runner
Create the .env file for your token (nano .env) and protect it so only root can read it:
ACCESS_TOKEN=YOUR_TOKEN
chmod 600 .env
Then create the docker-compose.yml file (nano docker-compose.yml) and add this content:
services:
runner:
image: myoung34/github-runner:2.338.2-ubuntu-noble
container_name: github-runner
restart: unless-stopped
environment:
RUNNER_SCOPE: repo
REPO_URL: https://github.com/YOUR-NAME/YOUR-REPO
ACCESS_TOKEN: ${ACCESS_TOKEN}
RUNNER_NAME: vserver-runner
LABELS: vserver,docker
RUNNER_WORKDIR: /tmp/github-runner/work
UNSET_CONFIG_VARS: "true"
security_opt:
- label:disable
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /tmp/github-runner:/tmp/github-runner
Here's what the important lines mean:
image: The runner image at a fixed version. Available versions are listed on Docker Hub. The runner program inside still updates itself if GitHub requires a new version.RUNNER_SCOPEandREPO_URL: Where the runner registers. For an organization, setRUNNER_SCOPE: organdORG_NAME: your-organization, and omitREPO_URL.ACCESS_TOKEN: Your token from the.envfile. The runner exchanges it for a registration token every time it starts.RUNNER_NAME: A fixed name. Without it, the image generates a random name every time it starts.LABELS: Custom labels used to target the runner inruns-on.RUNNER_WORKDIRand/tmp/github-runner: The jobs' working directory. It is on the host at the same path as in the container. This is necessary because containers started by your jobs run directly on the host and expect the checked-out files to be at the same path.UNSET_CONFIG_VARS: Removes the token and settings from the environment before jobs run./var/run/docker.sock: Gives jobs access to the server's Docker, as described in the warning under “Security: private repositories only.” If your workflows don't need Docker, omit this line.
Download the image and start the runner:
docker compose pull
docker compose up -d
Registration happens automatically when the runner starts. Follow the container output:
docker compose logs -f
Startup is successful when Listening for Jobs appears at the end. Stop viewing the output with Ctrl + C. The runner should now appear in GitHub under Settings > Actions > Runners with the Idle status. Start your first workflow as described above under “Run your first workflow on the runner.”
For more tips on securing your server, see Linux security tips.
The runner doesn't store any data you can't recover. Back up the docker-compose.yml and .env files from /opt/github-runner; that's all you need to rebuild it. The /tmp/github-runner directory only contains job working files and can be empty.
Change the image version in docker-compose.yml and restart:
cd /opt/github-runner
docker compose pull
docker compose up -d
docker image prune
When stopped, the runner signs out of GitHub. When started, it registers again. docker image prune then removes the old image.
Once setup is complete, you can target jobs to your runner and build with Docker.
GitHub selects the runner using the labels in runs-on. Every self-hosted runner automatically has self-hosted, Linux, and X64, as well as your custom labels. A job with runs-on: [self-hosted, vserver] will only run on runners that have both labels. If runs-on is still set to ubuntu-latest, the job will continue to use GitHub's servers as before. This lets you move individual jobs to your runner while leaving the rest on GitHub.
A runner only runs one job at a time. Other jobs wait until it's available. If you need more concurrency, install a second runner with the same labels.
Since the server's Docker socket is passed through, docker build, docker run, and docker compose work directly in your jobs. Images built by a job are stored on the VPS itself. This speeds up subsequent builds but uses storage, so clean up occasionally with docker image prune.
With the One-Click App, the jobs' working directory is in a Docker volume. If you start a container yourself in a job and mount files from the working directory, for example with docker run -v $PWD:/app, that container won't see the files. The same applies to jobs that use container: and to actions that run as Docker containers. In this case, build images with docker build and copy the files in with COPY, or use the manual installation, where the working directory is on the host at the same path.
If you uninstall the One-Click App or stop the container with docker compose down, the runner signs out of GitHub. If an Offline entry still remains in GitHub, remove it under Runners by opening the runner's menu and selecting Remove. If you no longer need the token, also delete it from Fine-grained tokens in GitHub.
- Linux jobs only: The runner runs in a Linux container. Workflows for Windows or macOS need a runner on those systems.
- No preinstalled software like GitHub's: GitHub's runners come with many languages and tools preinstalled. On your runner, install them with actions such as
actions/setup-nodeoractions/setup-python. - One job at a time: Each runner processes jobs one after another. You need multiple runners to run jobs in parallel.
- Not a substitute for a clean environment: Files and images remain between jobs. This speeds up builds but can affect results. Clean up in your workflows if a job needs a fresh environment.
With your own GitHub runner, your workflows now run on your server, with their own cache and without using up Actions minutes. To go with it, the guide Set Up Docker Registry on a Linux Server shows you how to store the images built in your workflows in a private registry.
If you have any other questions or need help, our support team is available every day! 🙂
