GitHub Actions "Invalid options for container"
The runner validates container.options against the docker create flags it allows. A reserved flag (the runner sets it itself) or an unknown option makes the job fail before startup.
What this error means
The job fails to initialize, reporting that one of the values in container.options is not a valid option.
github-actions
##[error]Invalid options for the container: --network host is not allowedCommon causes
A reserved flag was supplied
Options the runner manages itself (network, name, workspace mounts) cannot be overridden in container.options.
Unknown or malformed flag
A typo or an option not supported by docker create is rejected during validation.
How to fix it
Use only supported options
- Remove reserved flags such as --network or --name from container.options.
- Keep supported options like --cpus, --memory, or environment-related flags.
- Re-run.
.github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
container:
image: node:20-bookworm
options: --cpus 2 --memory 4g
steps:
- run: node --versionHow to prevent it
- Limit container.options to resource flags; let the runner manage networking and mounts.
- Validate option strings against docker create documentation before committing.
Related guides
GitHub Actions container job "workdir not found"Fix the GitHub Actions error where a container job sets an --workdir option pointing at a path that does not…
GitHub Actions "Container operations are only supported on Linux runners"Fix the GitHub Actions error where a job using "container:" runs on a Windows or macOS runner that does not s…
GitHub Actions container job "HOME is not set"Fix the GitHub Actions error where tools fail inside a container job because the HOME environment variable is…