docker exec --env FOO=bar myapp env

Category: Docker

docker exec --env FOO=bar myapp env

Run a command with an extra environment variable

Injects FOO=bar into the exec session without changing the container's stored config. Repeat --env for more variables, or use --env-file. The env command prints the resulting environment.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.