Skip to content
Latchkey

GitHub Actions "Container action is only supported on Linux" in CI

Docker container actions run only on Linux runners. Using one in a job that runs on windows-latest or macos-latest fails because container actions are not supported on those platforms.

What this error means

A job on a Windows or macOS runner fails with "Error: Container action is only supported on Linux" when it reaches a Docker-based uses:.

GitHub Actions
Error: Container action is only supported on Linux

Common causes

A Docker action on a non-Linux runner

The job's runs-on is Windows or macOS, but the action it calls is a container (Docker) action.

A matrix that includes non-Linux OSes

A matrix spreads the job across OSes, and the Linux-only container action fails on the non-Linux legs.

How to fix it

Run the Docker action on Linux

  1. Move the container action into a Linux job.
  2. Or replace it with a JavaScript/composite action that runs cross-platform.
  3. Re-run.
.github/workflows/ci.yml
jobs:
  scan:
    runs-on: ubuntu-latest   # container action needs Linux
    steps:
      - uses: docker://ghcr.io/acme/scanner:1

Restrict the matrix leg with if

Gate the container-action step so it only runs on Linux legs of a multi-OS matrix.

.github/workflows/ci.yml
- if: runner.os == 'Linux'
  uses: docker://ghcr.io/acme/scanner:1

How to prevent it

  • Use container actions only in Linux jobs.
  • Prefer JavaScript/composite actions for cross-platform steps.
  • Guard Linux-only steps with runner.os == 'Linux'.

Frequently asked questions

What causes ""only supported on Linux""?
The job's runs-on is Windows or macOS, but the action it calls is a container (Docker) action.
How do I fix "only supported on Linux"?
Run the Docker action on Linux

Related guides

References

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