# Ephemeral GitHub Actions Runners, Explained

> What an ephemeral GitHub Actions runner is, why one job per machine matters, and three ways to get one: --ephemeral, JIT configs, ARC, or a managed runner.

- URL: https://flockvm.com/learn/ephemeral-github-actions-runners
- Last updated: 2026-11-10

An ephemeral GitHub Actions runner takes exactly one job, then is removed, and the machine it ran on is thrown away. The next job starts on a clean machine, so nothing one job leaves behind (files, Docker images, credentials, a planted process) reaches the next. You get one by registering a self-hosted runner with `--ephemeral`, by starting it from a just-in-time (JIT) configuration generated through GitHub's API, by running Actions Runner Controller (ARC) on Kubernetes, or by using a managed runner that creates a fresh VM per job.

| | Persistent self-hosted runner | Ephemeral self-hosted runner |
|---|---|---|
| Jobs per runner | Any number, one after another | One |
| Machine between jobs | The same: workspace, caches, processes carry over | A new one for each job |
| Registration | Once, with `config.sh` | Per job: `config.sh --ephemeral` or a JIT config |
| Scaling | Fixed fleet, sized for the peak | Machines created on demand, from the `workflow_job` webhook |
| What a compromised job leaves | Whatever it planted, for the next job | Nothing, once the machine is deleted |
| What you run | The machines | The machines, plus an autoscaler that creates and deletes them |

GitHub's own advice: "GitHub recommends implementing autoscaling with ephemeral self-hosted runners; autoscaling with persistent self-hosted runners is not recommended." GitHub's facts on this page were read on its documentation on 8 November 2026. flockvm sells ephemeral runners: we say how ours work and where they stop.

## What is an ephemeral runner?

A runner is the GitHub Actions agent (`actions/runner`) running on a machine and registered with a repository, an organization or an enterprise. A persistent runner stays registered and takes job after job. An ephemeral one registers for a single job: "The GitHub Actions service will then automatically de-register the runner after it has processed one job."

"Ephemeral" covers the runner registration. Whether the **machine** is clean for the next job depends on what you do with it: a runner registered with `--ephemeral` on a long-lived server still leaves that server's disk, Docker images and processes behind. The pattern that gives a clean machine is one VM (or container) per job, created when the job is queued and deleted when it ends.

GitHub-hosted runners already work this way: "With the exception of single-CPU runners, each GitHub-hosted runner is a new virtual machine (VM) hosted by GitHub." The exception, `ubuntu-slim`, runs "inside a container rather than a full VM instance".

## Why one job per machine matters

A persistent runner shares state across every job it takes, from every workflow and every branch allowed to use it:

- **Files and caches.** The work folder, tool caches, `~/.npm`, Docker images and build outputs of one job are there for the next. A poisoned cache or a modified binary affects every later build.
- **Credentials.** A secret written to disk, a `docker login` config, a cloud CLI profile or an SSH key left by one job can be read by the next. GitHub notes that a secret passed as a command-line argument can be seen by another job on the same runner with `ps x -w`.
- **Processes.** A job can start a background process that outlives it and watches what later jobs do.
- **Agent state.** Coding agents that run in CI change the machine too. The `openai/codex-action` README warns that its user-account and socket changes "can outlive a job on reused self-hosted runners", and advises running that mode "on disposable runners".

The persistence case is not hypothetical. In the Shai-Hulud npm campaign of November 2025, as analysed by [Sysdig](https://www.sysdig.com/blog/how-threat-actors-are-using-self-hosted-github-actions-runners-as-backdoors), the malware registered infected machines as self-hosted runners with "the distinctive name, `SHA1HULUD`", then pushed a workflow that ran attacker commands on them. A machine that is deleted after one job cannot serve as that kind of foothold for long. [Self-hosted runner security](/learn/self-hosted-runner-security) covers the rest of the threat model.

GitHub's secure-use guide sums it up: "Self-hosted runners for GitHub do not have guarantees around running in ephemeral clean virtual machines, and can be persistently compromised by untrusted code in a workflow."

## Three ways to get an ephemeral runner

### 1. `config.sh --ephemeral`

The simplest one: register the runner with the `--ephemeral` flag, and it de-registers after one job.

```bash
./config.sh \
  --url https://github.com/acme/api \
  --token "$REGISTRATION_TOKEN" \
  --labels linux-ephemeral \
  --ephemeral \
  --unattended
./run.sh        # takes one job, then exits
```

Wrap it in a script that deletes the VM or container when `run.sh` exits and creates a new one, and you have one machine per job. The machine needs a registration token, which can register further runners until it expires.

### 2. A just-in-time (JIT) configuration

A JIT runner skips `config.sh`. Your controller asks GitHub's REST API for a single-use configuration, and the runner starts with it. GitHub describes JIT runners as runners that "perform at most one job before being automatically removed from the repository, organization, or enterprise."

```bash
# On the controller, when a job is queued:
JIT=$(curl -sS -X POST \
  -H "Authorization: Bearer $GITHUB_TOKEN" \
  -H "Accept: application/vnd.github+json" \
  https://api.github.com/repos/acme/api/actions/runners/generate-jitconfig \
  -d '{"name": "job-8812", "runner_group_id": 1, "labels": ["self-hosted", "linux", "x64", "linux-ephemeral"]}' \
  | jq -r .encoded_jit_config)

# Inside the new machine:
./run.sh --jitconfig "$JIT"
```

The organization endpoint is `POST /orgs/{org}/actions/runners/generate-jitconfig`, with the same body. `name`, `runner_group_id` and `labels` are required, and the token needs admin access to the repository or organization. A GitHub App needs the repository permission "Administration" (write) for the repository endpoint, and the organization permission "Self-hosted runners" (write) for the organization one. The machine never holds a registration token, only a config valid for one runner: that is why JIT is the better choice for an autoscaler.

### 3. Actions Runner Controller (ARC) on Kubernetes

ARC is "a Kubernetes operator that orchestrates and scales self-hosted runners for GitHub Actions". Its runner scale sets create runner pods as jobs arrive, through an "EphemeralRunner" controller, and remove them after. The quickstart is two Helm charts:

```bash
helm install arc \
  --namespace arc-systems --create-namespace \
  oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller

helm install arc-runner-set \
  --namespace arc-runners --create-namespace \
  --set githubConfigUrl="https://github.com/acme" \
  --set githubConfigSecret.github_token="$GITHUB_PAT" \
  oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set
```

Jobs then target the scale set by its name, `runs-on: arc-runner-set`. GitHub "only supports the latest Autoscaling Runner Sets version of ARC", and recommends "that organizations have staff with expert-level knowledge of container orchestration". Building images with Docker-in-Docker and image caching are outside GitHub Support's scope. For autoscaling without Kubernetes, GitHub also publishes the Runner Scale Set Client, "a standalone Go-based module" for building your own.

## Container per job or VM per job?

ARC gives each job a pod: a container on a node that runs other pods. Containers share the node's kernel, so a kernel exploit or a container escape reaches the node and everything on it, and in Docker-in-Docker mode, "the Docker-in-Docker container requires privileged mode". A VM per job gives each job its own guest kernel behind hardware virtualization. Firecracker microVMs were built for this kind of short, untrusted workload: they boot their own kernel with a small device model. [MicroVM vs container](/learn/microvm-vs-container) goes through the difference, and [Firecracker sandboxes](/firecracker-sandbox) through the technology.

For CI that only runs your own team's code, a container per job may be enough. For jobs that run code from many contributors, dependencies you don't review, or coding agents, the VM boundary is the safer default.

## Building it yourself: what you have to run

The loop is short to describe:

1. Subscribe to the `workflow_job` webhook. GitHub documents it for this: "You can create your own autoscaling environment by using payloads received from the `workflow_job` webhook."
2. On a `queued` event whose labels you serve, generate a JIT config and create a machine with it.
3. The machine runs `run.sh --jitconfig`, takes the job, and exits.
4. Delete the machine, and remove the runner from GitHub if it is still registered.

What makes it a project, not a script:

- **Image updates.** "If you do not perform a software update within 30 days, the GitHub Actions service will not queue jobs to your runner." Your base image needs a rebuild at each runner release.
- **Cleanup.** A machine that dies mid-job leaves a registered runner and a running bill. Something has to find and remove both.
- **Webhooks.** Deliveries can arrive twice or not at all; the controller has to be idempotent and reconcile with GitHub's job state.
- **Capacity.** Quotas, a queue when they are reached, and someone on call when jobs pile up.
- **Boot time.** Every job waits for a machine to boot and the runner to register.

## Managed runners that give a fresh VM per job

Each of these registers its machines as self-hosted runners and changes one `runs-on:` label. On their own pages, read on 8 November 2026:

- **GitHub-hosted**: a new VM per job, except the 1-core `ubuntu-slim` container.
- **Blacksmith**: a Firecracker microVM per job, on its own bare-metal hardware, destroyed after.
- **Depot**: ephemeral EC2 instances, never reused.
- **Namespace**: a VM with its own kernel per job.
- **Ubicloud**: a fresh VM per job.
- **WarpBuild**: a fresh VM per job.
- **RunsOn**, in your own AWS account: "Every job runs on an EC2 instance that no other job has used."
- **flockvm**: a Firecracker microVM per job, in France (below).

They differ on price, platforms, regions and concurrency far more than on isolation: [cheap GitHub Actions runners](/compare/cheap-github-actions-runners) compares them on those.

## How flockvm does it

flockvm runs the loop above for you, with one [Firecracker microVM](/docs/ci/overview) per job:

1. GitHub sends a `workflow_job` webhook for every job queued in a connected repository, whatever its labels; flockvm checks its signature, ignores jobs that ask for no flockvm label, and queues the ones with `runs-on: flockvm` (or another flockvm label).
2. When a slot is free, flockvm calls `generate-jitconfig` on your repository and boots a VM. The JIT config reaches the VM through its metadata service and is never written to a log.
3. Inside the VM, the GitHub runner starts once with `run.sh --jitconfig`, takes the job and exits. Boot and registration take about 25 seconds, billed.
4. flockvm deletes the VM and removes the runner from your repository if it is still registered. A VM is never reused, even for the next job of the same repository, and nobody can SSH into it.

The limits are real: at most 4 runner VMs at once on the host, across all organizations; Linux x64 only (Ubuntu 26.04); private repositories only; no cache between jobs; a 6-hour job timeout; no certification. It fits a small team's private Linux jobs at a third of GitHub's Linux x64 rate for the same vCPUs, counted by the second ([pricing](/learn/github-actions-pricing)); it does not replace an ARC fleet that runs hundreds of jobs at once or reaches your private network. [CI security](/docs/ci/security) has the details, and [GitHub Actions runners on Firecracker](/github-actions-runners) the short version. Since every job starts on an empty VM, the caching fixes in [how to speed up GitHub Actions](/learn/speed-up-github-actions) matter more here than on a persistent runner.

## FAQ

### Are GitHub-hosted runners ephemeral?

Yes. "With the exception of single-CPU runners, each GitHub-hosted runner is a new virtual machine (VM) hosted by GitHub." The 1-core `ubuntu-slim` runner runs in a container instead.

### What is a JIT runner in GitHub Actions?

A just-in-time runner starts from a single-use configuration that your code requests from `POST /repos/{owner}/{repo}/actions/runners/generate-jitconfig` (or the organization endpoint). It takes at most one job and is then removed. Unlike `config.sh --ephemeral`, the machine never needs a registration token.

### What is the difference between `--ephemeral` and a JIT runner?

Both take one job. `--ephemeral` registers through `config.sh` with a registration token, on the machine. A JIT runner gets its configuration from the API, through the controller, and runs `run.sh --jitconfig` directly. Autoscalers, flockvm's included, generally use JIT.

### Does ARC create ephemeral runners?

Yes. ARC's autoscaling runner sets, the only mode GitHub supports, create ephemeral runner pods as jobs arrive and remove them after. Each pod is a container on a shared Kubernetes node, not a VM.

### Do ephemeral runners make CI slower?

Each job pays for a fresh machine: a boot and a runner registration, and caches that start empty. Restore dependencies with `actions/cache` or the `cache:` input of `setup-*` actions, and use a registry cache for Docker layers.

## Sources

- [GitHub Docs: Self-hosted runners reference (ephemeral runners, workflow_job autoscaling, Runner Scale Set Client, 30-day updates)](https://docs.github.com/en/actions/reference/runners/self-hosted-runners) (accessed 2026-11-08)
- [GitHub Docs: REST API endpoints for self-hosted runners (generate-jitconfig)](https://docs.github.com/en/rest/actions/self-hosted-runners) (accessed 2026-11-08)
- [GitHub Docs: Secure use reference (just-in-time runners, self-hosted runner hardening)](https://docs.github.com/en/actions/reference/security/secure-use) (accessed 2026-11-08)
- [GitHub Docs: GitHub-hosted runners (a new VM per job, except single-CPU runners)](https://docs.github.com/en/actions/concepts/runners/github-hosted-runners) (accessed 2026-11-08)
- [GitHub Docs: GitHub-hosted runners reference (ubuntu-slim runs in a container)](https://docs.github.com/en/actions/reference/runners/github-hosted-runners) (accessed 2026-11-08)
- [GitHub Docs: Actions Runner Controller](https://docs.github.com/en/actions/concepts/runners/actions-runner-controller) (accessed 2026-11-08)
- [GitHub Docs: Support for Actions Runner Controller](https://docs.github.com/en/actions/concepts/runners/support-for-arc) (accessed 2026-11-08)
- [GitHub Docs: Quickstart for Actions Runner Controller](https://docs.github.com/en/actions/tutorials/use-actions-runner-controller/quickstart) (accessed 2026-11-08)
- [GitHub Docs: Deploying runner scale sets with ARC (Docker-in-Docker mode)](https://docs.github.com/en/actions/how-tos/manage-runners/use-actions-runner-controller/deploy-runner-scale-sets) (accessed 2026-11-08)
- [Sysdig: How threat actors are using self-hosted GitHub Actions runners as backdoors (13 January 2026)](https://www.sysdig.com/blog/how-threat-actors-are-using-self-hosted-github-actions-runners-as-backdoors) (accessed 2026-11-08)
- [openai/codex-action README (reused self-hosted runners)](https://github.com/openai/codex-action) (accessed 2026-11-08)
- [Blacksmith: Security (a Firecracker microVM per job, destroyed after)](https://www.blacksmith.sh/security) (accessed 2026-11-08)
- [Depot docs: GitHub Actions runners overview (ephemeral EC2 instances)](https://depot.dev/docs/github-actions/overview.md) (accessed 2026-11-08)
- [Namespace: Defense in depth, how we think about security (5 May 2026)](https://namespace.so/blog/defense-in-depth-how-we-think-about-security) (accessed 2026-11-08)
- [Ubicloud docs: GitHub Actions compliance (a fresh VM per job)](https://ubicloud.com/docs/github-actions-integration/compliance.md) (accessed 2026-11-08)
- [WarpBuild docs: Security](https://www.warpbuild.com/docs/ci/security) (accessed 2026-11-08)
- [RunsOn docs: Control plane security](https://runs-on.com/docs/control-plane/security/) (accessed 2026-11-08)
- [GitHub Docs: Permissions required for GitHub Apps (Administration, Self-hosted runners)](https://docs.github.com/en/rest/authentication/permissions-required-for-github-apps) (accessed 2026-11-08)
- [GitHub Docs: Webhook events and payloads (workflow_job)](https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_job) (accessed 2026-11-08)
