Skip to content
Latchkey

Dockerfile LABEL "Syntax error - can't find = in" in CI

The parser rejected a LABEL that is not written as name=value. The same check applies to ENV in key=value form: each token must contain an equals sign.

What this error means

docker build fails with "dockerfile parse error: Syntax error - can't find = in \"X\". Must be of the form: name=value" while reading a LABEL line.

docker build
dockerfile parse error line 3: Syntax error - can't find = in "maintainer". Must be of the form: name=value

Common causes

A LABEL with no value

The line is LABEL maintainer with no =value, so the parser cannot form a key/value pair.

A malformed multi-pair LABEL

Mixing space-separated tokens that are not valid name=value pairs triggers the same error.

How to fix it

Write LABEL as name=value

Use an equals sign for each label.

Dockerfile
LABEL maintainer="team@example.com" \
      org.opencontainers.image.source="https://github.com/acme/app"

Quote values that contain spaces

  1. Confirm each label is a name=value pair.
  2. Quote any value with spaces or special characters.
  3. Re-run the build.

How to prevent it

  • Always write LABEL and ENV pairs with an equals sign.
  • Quote label values that contain spaces.
  • Lint Dockerfiles to catch malformed LABEL lines.

Related guides

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