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.
dockerfile parse error line 3: Syntax error - can't find = in "maintainer". Must be of the form: name=valueCommon 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.
LABEL maintainer="team@example.com" \
org.opencontainers.image.source="https://github.com/acme/app"Quote values that contain spaces
- Confirm each label is a
name=valuepair. - Quote any value with spaces or special characters.
- 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.