docker run --env-file .env --env-file .env.local myimage

Category: Docker

docker run --env-file .env --env-file .env.local myimage

Run with variables from multiple env files

Loads environment variables from both files, with later files overriding earlier duplicates. Keep secrets out of the compose file by using env files. Contrast with docker run -e for inline values.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.