Skip to content
Latchkey

Dockerfile HEALTHCHECK "Unknown flag" in CI

The Dockerfile parser rejected a flag it does not know. HEALTHCHECK --start-interval was added in Docker Engine 25.0, so an older Engine in CI fails to parse it.

What this error means

docker build fails early with "Unknown flag: start-interval" while parsing the HEALTHCHECK instruction, before any layer is built.

docker build
Dockerfile:12
--------------------
  12 | >>> HEALTHCHECK --start-interval=5s --interval=30s CMD curl -f http://localhost/ || exit 1
--------------------
ERROR: failed to solve: Unknown flag: start-interval

Common causes

A flag newer than the Engine in CI

--start-interval requires Docker Engine 25.0 or later; an older runner Engine does not recognize it.

A typo in the flag name

A misspelled HEALTHCHECK flag is also reported as an unknown flag by the parser.

How to fix it

Upgrade the Docker Engine on the runner

  1. Confirm the runner Engine version with docker version.
  2. Upgrade to Engine 25.0 or later to gain --start-interval.
  3. Re-run the build once the newer Engine is in place.
Terminal
docker version --format '{{.Server.Version}}'

Drop the unsupported flag

Remove --start-interval and rely on the supported timing flags if you cannot upgrade.

Dockerfile
HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost/ || exit 1

How to prevent it

  • Match Dockerfile features to the Engine version your CI runs.
  • Pin or document the minimum Docker Engine your image needs.
  • Double-check flag spelling against the instruction reference.

Related guides

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