Lesson 10 / 26

Environment Variables

Pass configuration into a container without baking it into the image.

-e and --env-file

Use -e KEY=value for one-off variables, or --env-file to load many from a file — handy for secrets and per-environment config.

docker run -d -e NODE_ENV=production -e PORT=3000 my-app:1.0
docker run -d --env-file .env my-app:1.0