Skip to content
Latchkey

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 allowed

Common 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

  1. Remove reserved flags such as --network or --name from container.options.
  2. Keep supported options like --cpus, --memory, or environment-related flags.
  3. 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 --version

How 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →