- Symptom
- The variable arrives in the container as "hello world" with the quotes includedThe same env file works with docker compose env_file but breaks with docker run --env-file
- Cause
- docker run --env-file reads each line as a raw NAME=value with no quote handling, while Compose parses env files with shell-like quoting. CLI maintainers treat the raw format as intended, so the two stay different.
- Fix
- Keep a separate unquoted file for docker run --env-file, pass the values with -e, or start the container through Compose.
- Apply
# app.env used with: docker run --env-file app.env image GREETING=hello world # not GREETING="hello world"- Affected
- Docker CLI, all versions through October 2026 (issue open since 2022)
- Sources
Last verified 2026-10-15 · Confirmed by 0 builders