Sometimes you create a docker-compose by your own, but when launching your stack, the two services seems to not being reachable. An example : In your docker-compose, your backend can’t connect to the database
First import your docker-compose file in the playground. Then you could see how things are connected together.
If the links look like bellow, so you have to connect the two services to a common network allow them to reach others

So this (upper) look like this (bellow)

Your docker-compose services are connected but can’t reach ?
Have you used the correct hostname ? In the docker-compose bellow, the nginx serice have to use http://backend to reach the backend service and not localhost ! Docker-compose networks have their own DNS.
name: test
services:
nginx:
image: nginx:latest
networks:
- hephaestus_chick
backend:
networks:
- hephaestus_chick
networks:
hephaestus_chick:
The hostnames are correct ?
try using the ping cmd from a container to reach the other one. You can use the docker exec to launch a ping from one container to another :
docker exec container_name_nginx ping -c 3 backend
if the container still look to be unreachable, try to inspect the network using :
docker network inspect docker_network_name
That will give you an output like this :
[
{
"Name": "dionysus_calf_hephaestus_chick",
"Id": "039db46f5b3e2a6bd9c4bc322eabd849c1211c979f4faadcb1aa3ecc32d5a509",
"Created": "2024-12-04T18:07:00.669412851-05:00",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "192.168.148.0/24",
"Gateway": "192.168.148.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"06fd9566ba0161b8e4a80cf7b84ae27b9d089a355949db5e96075aae31e81f6e": {
"Name": "dionysus_calf-backend-1",
"EndpointID": "eae118f0954db6caad3257641f24416621047b5896d8dd4f955d34ec0d9f5b32",
"MacAddress": "02:42:c0:a8:94:02",
"IPv4Address": "192.168.148.2/24",
"IPv6Address": ""
},
"9ac2a60d0d80285bfed27da7b5e8ecf991a399b5347d99bd4f002c58c7f90c46": {
"Name": "dionysus_calf-Nginx-1",
"EndpointID": "8f1b762e8a8ac18e67d62b5fb7e655e48d91149e9a9bedd58657ffc705a50e9b",
"MacAddress": "02:42:c0:a8:94:03",
"IPv4Address": "192.168.148.3/24",
"IPv6Address": ""
}
},
"Options": {},
"Labels": {
"com.docker.compose.network": "hephaestus_chick",
"com.docker.compose.project": "dionysus_calf",
"com.docker.compose.version": "2.29.7"
}
}
]
Here, under Containers, you can see all connected containers to the network
