Docker · tool · fg-0259

docker run --env-file keeps the quote characters that Compose and shells strip from values

If you see The variable arrives in the container as "hello world" with the quotes included, the cause and the fix for Docker are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
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

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun