User Story
As a DevOps engineer,
I want to define a shared Docker network in docker-compose.yml
so that backend and frontend services communicate explicitly via a dedicated network,
preventing unpredictable behavior in scaled environments.
Background
The current docker-compose.yml (lines 1-20) relies on Docker’s default bridge network, which:
- Implicitly connects services without clear dependencies.
- Risks port conflicts or misrouted traffic when scaling (e.g., multiple backend instances).
- Lacks explicit network naming, making debugging and service discovery harder.
The frontend’s App.js (line 7) hardcodes http://0.0.0.0:80/ for backend communication, which may fail if the backend’s hostname or port changes in scaled deployments.
Acceptance Criteria
User Story
As a DevOps engineer,
I want to define a shared Docker network in
docker-compose.ymlso that backend and frontend services communicate explicitly via a dedicated network,
preventing unpredictable behavior in scaled environments.
Background
The current
docker-compose.yml(lines 1-20) relies on Docker’s default bridge network, which:The frontend’s
App.js(line 7) hardcodeshttp://0.0.0.0:80/for backend communication, which may fail if the backend’s hostname or port changes in scaled deployments.Acceptance Criteria
docker-compose.ymlto:app_network) undernetworks.backendandfrontendservices to this network.App.jsto use the backend service name (e.g.,http://backend/) instead of0.0.0.0:80.docker-compose upand confirming the frontend displays the backend’s "Hello World" message.docker-compose up --scale backend=2and verifying the frontend can communicate with all instances.docker network inspect [network_name]to confirm both services are attached.