Interview Prep/Docker/Networking, DNS and Compose

Compose: `The "DB_PASSWORD" variable is not set. Defaulting to a blank string.`

BeginnerTroubleshootingNetworking, DNS and Compose
Answer

Likely causes → .env missing/not in the project dir, variable only exported in a different shell, or typo.

Diagnose → docker compose config | grep -i password; ls -la .env.

Fix → Create .env next to compose file or use --env-file; require it with ${DB_PASSWORD:?missing}.

Prevent → Fail fast using :? syntax.

All Docker questions Roadmap: Docker & containers

More on Networking, DNS and Compose