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.
##[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.
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.