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.
More on Networking, DNS and Compose
`curl: (7) Failed to connect to localhost port 8080: Connection refused` after `docker run -p 8080:80 nginx`.Beginner`Bind for 0.0.0.0:5432 failed: port is already allocated`BeginnerContainers cannot reach the internet: `Temporary failure in name resolution`Advanced`ping` works to IPs but DNS names fail on the default bridge: `ping: bad address 'db'`Beginner`getaddrinfo ENOTFOUND db` in a Compose app.BeginnerCompose: `service "api" depends on undefined service "db"`Beginner