GitHub Actions "Container action is only supported on Linux"
A Docker container action (runs.using: docker) can only run on Linux runners. Using it on a windows- or macos- runner fails because those runners cannot execute Linux container actions.
What this error means
A step calling a Docker-based action fails immediately on a Windows or macOS runner with "Container action is only supported on Linux", before the action does anything.
Actions log
Error: Container action is only supported on LinuxCommon causes
Docker action on a non-Linux runner
Actions with runs.using: docker (or Dockerfile-based) need a Linux runner. windows-latest and macos-latest cannot run them.
A matrix that includes non-Linux OSes
A cross-OS matrix that uses a Docker action on every leg fails on the Windows/macOS legs even if Linux passes.
How to fix it
Run the Docker action on Linux only
Gate the Docker-action step (or the whole job) to Linux runners.
.github/workflows/ci.yml
jobs:
scan:
runs-on: ubuntu-latest # Docker action requires Linux
steps:
- uses: some/docker-action@v1Use a cross-platform alternative
- Prefer a JavaScript or composite action that runs on all OSes.
- In a cross-OS matrix, add if: runner.os == 'Linux' to Docker-action steps.
- Replicate the action logic with run: steps on Windows/macOS where no portable action exists.
How to prevent it
- Use JavaScript/composite actions for cross-OS workflows.
- Pin Docker-based actions to Linux jobs.
- Guard Docker steps with runner.os checks in mixed matrices.
Related guides
GitHub Actions "The hosted runner lost communication with the server"Fix GitHub Actions "The hosted runner lost communication with the server" - an infrastructure blip that drops…
GitHub Actions "The runner has received a shutdown signal" (Spot Reclaim)Fix GitHub Actions jobs killed by "The runner has received a shutdown signal" on spot/preemptible runners - t…
GitHub Actions "Unable to process file command 'env' ... Invalid format"Fix GitHub Actions "Unable to process file command 'env' successfully ... Invalid format" - a multiline value…