Skip to content
Latchkey

GitHub Actions "Container operations are only supported on Linux runners"

Job-level "container:" requires a Linux runner. macOS and Windows GitHub-hosted runners cannot run container jobs or service containers, so the job fails at initialization.

What this error means

A job with a "container:" key on runs-on macos-latest or windows-latest fails immediately, reporting that containers are Linux-only.

github-actions
##[error]Container operations are only supported on Linux runners.

Common causes

runs-on is not a Linux image

The job specifies a macOS or Windows runner while also declaring container or services, which only the Linux runtime supports.

How to fix it

Move the container job to a Linux runner

  1. Set runs-on to ubuntu-latest (or a Linux self-hosted label) for any job using container or services.
  2. If you genuinely need macOS/Windows, drop the container and install tooling directly on the runner.
  3. Re-run.
.github/workflows/ci.yml
jobs:
  test:
    runs-on: ubuntu-latest
    container: node:20-bookworm
    steps:
      - uses: actions/checkout@v4
      - run: node --version

How to prevent it

  • Keep container and service jobs on Linux runners.
  • When a matrix spans operating systems, gate the container key so it only applies to Linux entries.

Frequently asked questions

What causes ""container only supported on Linux runners""?
The job specifies a macOS or Windows runner while also declaring container or services, which only the Linux runtime supports.
How do I fix "container only supported on Linux runners"?
Move the container job to a Linux runner

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card