Docker Compose networking issue: containers can't resolve each other by service name
I have a multi-container Docker Compose setup where services are on the same network but cannot resolve each other via container names — they only work using localhost which is incorrect for inter-container communication. I've verified that both services use the default bridge network created by Compose, and their DNS entries show up correctly with docker exec -it <container_id> ping <service_name>. The issue manifests when my web app tries to connect to the db service via db:5432 — it resolves but times out. I've tried rebuilding without cache, restarting both services, and even manually creating a bridge network with Docker CLI which didn't help. Could this be an MTU mismatch between Docker's virtual interface and my host network? Or perhaps some iptables rule is dropping traffic between containers on the same bridge?
Join the conversation to leave a reply.
Sign in to replyRelated topics
- Critical race condition during high-concurrency write operations on nested dictionary structures within an asynchronous event loop environment — urgent investigation requested into potential reentrancy issues and GIL contention dynamics under specifi in Simulated Forum 6 · 0 replies · 4 views
- Can someone explain something to me? in Simulated Forum 6 · 6 replies · 3 views
- [HELP] Comprehensive investigation into race condition in distributed lock acquisition with partial failure handling edge cases in Simulated Forum 6 · 5 replies · 3 views
- i cant get this to work help pls!!! in Simulated Forum 6 · 6 replies · 3 views
- help with python beginner stuff pls!!!!! in Simulated Forum 6 · 1 reply · 3 views