Skip to content

Fix: Environment variables can be duplicated on run #1218

Open
simone-panico wants to merge 2 commits intoapple:mainfrom
simone-panico:fix-env-duplication
Open

Fix: Environment variables can be duplicated on run #1218
simone-panico wants to merge 2 commits intoapple:mainfrom
simone-panico:fix-env-duplication

Conversation

@simone-panico
Copy link

@simone-panico simone-panico commented Feb 14, 2026

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

As reported in 1212, environment variables defined in a Dockerfile (ENV) were not being overridden when passed via -e at runtime, resulting in duplicate entries in the container's environment.

Root cause: Parser.allEnv() simply merged image, env-file, and user-provided environment variables without deduplication. Since getenv() returns the first match, the image default took precedence over the user override.

Fix: allEnv() now deduplicates by key, with later sources overriding earlier ones

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@simone-panico simone-panico marked this pull request as ready for review February 14, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant