You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Legacy ENV key value with a multi-word value becomes an invalid key=value #69
Converting a legacy ENV key value instruction to the key=value form breaks when the value contains spaces. The output is not a valid Dockerfile: docker build rejects it, and so does dockerfmt on the next run.
Reproduce
FROM alpine
ENV JAVA_OPTS -Xms256m -Xmx512m
dockerfmt Dockerfile
Actual
FROM alpine
ENV JAVA_OPTS=-Xms256m -Xmx512m
The original builds and sets JAVA_OPTS=-Xms256m -Xmx512m. docker build on the output, and dockerfmt run on it again, both fail with:
Error parsing file: Syntax error - can't find = in "-Xmx512m". Must be of the form: name=value
Expected
In the legacy form everything after the key is the value, so the converted instruction needs quotes:
ENV JAVA_OPTS="-Xms256m -Xmx512m"
Leaving the instruction in its legacy form would also be correct.
Impact
With --write the Dockerfile no longer builds. In a sample of about 450 real-world Dockerfiles, 112 lines used the legacy ENV form and one of them had an unquoted multi-word value.
Activity
RyoKusnadi commentedon Nov 5, 2026
@reteps I opened #74 for this. Could you please review it when you have a moment? Thank you!
Merge pull request #83 from reteps/fix/shell-rewrite