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-intervalCommon 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
- Confirm the runner Engine version with
docker version. - Upgrade to Engine 25.0 or later to gain
--start-interval. - 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 1How 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
Dockerfile ONBUILD build trigger failure in CIFix an ONBUILD build trigger failure in CI - a base image defines ONBUILD instructions that fire when you bui…
Dockerfile EXPOSE "invalid containerPort" in CIFix "invalid containerPort: X" on a Dockerfile EXPOSE in CI - the port value is non-numeric or malformed, oft…
Dockerfile "the --chmod option requires BuildKit" in CIFix "the --chmod option requires BuildKit" in a Docker build in CI - a COPY or ADD uses --chmod while the leg…