The "It Works On My Machine" Illusion
You've built a beautiful, decoupled microservices architecture. Your Node/Express API runs smoothly on port 3000, and your React frontend fetches data perfectly from http://localhost:3000/api . You containerize both services, spin them up with Docker Compose, and suddenly the frontend crashes with a Connection Refused error.
What happened? You fell into the localhost trap.
Understanding Docker's Internal Network
When running services locally without Docker, localhost refers to your host machine. Both your frontend and backend share this environment. However, when you containerize these services, Docker creates an isolated virtual network.…