Portainer GitHub Runner
Move that one long CI job onto your own machine.
In short
A self-hosted GitHub Actions runner as one Portainer stack: two services, one environment block, no build step. It moves long CI jobs onto your own hardware and cleans up after itself. Still in development and not proven in production.
- Who is it for?
- Teams with private repositories whose GitHub Actions bill is dominated by one long job.
- Runs on
- PortainerDocker ComposeGitHub Actions
- What does it cost?
- Nothing. The source is open, under the MIT license.
What it’s about
You look at the Actions bill and see that almost all of it comes from one job. Usually it is the browser tests. A real example: a push that cost 60 billed minutes, 52 of them that one job. Moving it removed 87 % of the bill.
This project packages a runner of your own as a Portainer stack. Point it at a repository, fill five variables, deploy. The fast jobs stay on GitHub, so a push still gets its verdict when your own server is off.
One thing up front, honestly: the runner uses the host’s Docker socket, and that is root on that machine. For a private repository with people you trust, on a host with nothing precious on it, that is a fair trade. For a public repository it is not.
What it does
The stack
- Two services, the runner and the prune, with one environment block in Portainer.
- A work directory with the same path inside and out. Bind mounts in your jobs actually resolve, instead of silently mounting empty folders.
- A label of its own, so only the jobs you meant for it land here.
Cleaning up
- An hourly prune of images, build cache and stopped containers older than 24 hours. What the next job needs stays.
- Volumes are left alone unless you explicitly allow it.
cleanup.shto reset a host. It reports first and changes nothing until you name a scope.- The stack opts out of Watchtower. An auto-updater that restarts the runner mid-job loses the job.
What it does not do
- State in a reused volume, such as a seeded test database, is invisible to any prune. Clean it up in the workflow, before and after the job.
- Actions that install tooling are written for GitHub’s own images and sometimes fail in a container without a reason.
- No job has run end to end on it yet. Pin a commit if a surprise would cost you something.
Getting started
-
Create the work directory on the host and hand it to the runner user:
sudo mkdir -p /srv/e2e-ci/_work sudo chown 1000:1000 /srv/e2e-ci/_work -
In the repository, get a registration token under Settings → Actions → Runners → New self-hosted runner.
-
In Portainer, go to Stacks → Add stack → Repository and use
https://github.com/NoiXdev/portainer-github-runnerwithdocker-compose.yml. Paste the example variables and fill the five required values. -
Only once the runner shows as Idle on GitHub, point your job’s
runs-onat its label.
The documentation explains every step, every variable and the security questions. Read the security part before you deploy, not after.
Portainer GitHub Runner compared
We like the other tools too. Here they are, side by side and honest.
| Portainer GitHub Runner | GitHub-hosted runners | actions-runner-controller | myoung34/github-runner (image only) | |
|---|---|---|---|---|
| Runs on your own hardware | ✓yes | –no | ✓yes | ✓yes |
| Uses your Actions allowance on private repos | –no | ✓yes | –no | –no |
| Fresh, isolated environment for every job | –no | ✓yes | ✓yes | optional (ephemeral) |
| Needs Kubernetes | –no | –no | ✓yes | –no |
| Cleans up old images and containers | yes, hourly | not needed, new VM per job | short-lived runners | –no |
| Ready-made Portainer stack | ✓yes | not needed | Helm chart | image only |
| No machine of your own to look after | –no | ✓yes | –no | –no |
As of November 2026. GitHub announced a charge for self-hosted runners and then postponed it. Check GitHub's current billing page before you plan around it. No guarantee of accuracy; corrections welcome as an issue.
When something else fits better
Not every tool fits every job. In these cases we'd point you somewhere else ourselves:
When your jobs are short or the repository is public. Then a runner of your own saves nothing and only adds upkeep.
When you need isolation rather than trust, for example for pull requests from forks, and you already run Kubernetes.
When you do not use Portainer and would rather assemble the stack yourself. Our stack uses this image by default.
Frequently asked questions
Does a self-hosted runner cost GitHub minutes?
Not according to GitHub's billing page, as of November 2026. An announced charge was postponed, so check the current page before you plan.
Is a runner of my own worth it for every job?
No, only for long ones. Moving a two-minute typecheck saves nothing. Move the one job that dominates the bill and leave the fast ones on GitHub.
Is this safe for public repositories?
No. The runner uses the host's Docker socket, which is root on that machine. A stranger's pull request would run as root.
Why can my build not find files that are plainly there?
Usually the work directory is not mounted at the same path as on the host. Docker then silently creates empty folders. That is why the stack uses the same path everywhere.
Does the prune delete my volumes?
No, not unless you explicitly allow it. On a shared host a volume prune would destroy other stacks' data.
Is it production-ready?
Not yet. It is in use, but no job has run end to end on it so far. Pin a commit rather than tracking main.
Something broken, or missing?
An issue in the repository is the quickest way. For wishes and questions too.
Open an issueRather ask directly?
Our Discord is where we help out, and so do other people who use the tool.
Join the DiscordFrom the logbook
- New project
Work in progress: a GitHub runner as a Portainer stack
A self-hosted GitHub Actions runner as a single Portainer stack that moves long CI jobs onto your own hardware. Still in progress.