GitHub Actions: Runners, Containers, Services, and Self-Hosted Execution

GitHub-hosted runners, self-hosted runners, job containers, service containers, labels, and operational patterns for GitHub Actions execution.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all

Choosing and targeting runners

Pick the right execution environment for the workload.

Use a GitHub-hosted Ubuntu runner

Run a job on Linux.

yamlANYruns-onubuntu
yaml
runs-on: ubuntu-latest
Notes

Ubuntu is the most common runner for CI workloads.

Target a self-hosted runner

Run on infrastructure you manage.

yamlANYself-hostedlabels
yaml
runs-on: [self-hosted, linux, x64]
Notes

Self-hosted runners are useful for private networks, special hardware, or custom tooling.

Run the job inside a container

Use a container image as the job runtime.

yamlANYcontainerjob
yaml
container:
  image: node:20-bookworm
Notes

Job containers help standardize tools and dependencies across runs.

Services and operational patterns

Add dependent services and keep runners maintainable.

Start a Redis service for tests

Use a service container for integration or cache tests.

yamlANYredisservices
yaml
services:
  redis:
    image: redis:7
    ports:
      - 6379:6379
Notes

Service containers provide disposable dependencies within a single workflow run.

Label-based runner targeting

Match jobs to specialized self-hosted infrastructure.

yamlANYrunner-labelsgpu
yaml
runs-on: [self-hosted, gpu, linux]
Notes

Runner labels let you route GPU builds, ARM builds, or deployment jobs to the correct machines.

Inspect the workspace path

Print the checkout path on the runner.

bashANYworkspacedebug
bash
echo "$GITHUB_WORKSPACE"
Notes

Helpful when debugging path assumptions in containerized or self-hosted environments.

Recommended next

No recommendations yet.