# The service on the other Docker network

The API is running and responds locally, but the client cannot resolve its
service name. Investigate the two Docker networks and restore communication
using the Compose configuration. Keep both networks internal, preserve the
application and do not publish host ports or hardcode an IP address.

## Before you begin

Use a disposable machine with Bash, Python 3, Docker and Docker Compose.
The lab creates the Compose project `breakfix-netops-04` and two internal
Docker networks. It does not publish ports or create cloud resources. Docker
may download the Python image. Do not reuse the project name; setup refuses
existing project resources and teardown checks ownership.

## Investigate

```sh
./setup.sh
docker compose -p breakfix-netops-04 ps
docker compose -p breakfix-netops-04 exec api python -c 'from urllib.request import urlopen; print(urlopen("http://127.0.0.1:8080/health.txt").read().decode())'
docker compose -p breakfix-netops-04 exec client python -c 'import socket; print(socket.getaddrinfo("api", 8080))'
docker network inspect breakfix-netops-04_front breakfix-netops-04_back
```

Inspect `compose.yaml`. Preserve the existing networks and persist your
network change there; recreate the affected container with Compose so the
configuration and running state agree. Then run `./verify.sh` and
`./teardown.sh`. Teardown removes the lab containers and networks but does not
reset edited files; re-extract the bundle to start again.

The [related Docker networking guide and demo](https://opsbreakfix.com/devops/understand-docker-volumes-and-container-networking/#see-it-run)
show a network inspection and a direct container request. The demo does not
reproduce this split-network scenario.
