docker-compose make requests between containers
so I'm not so sure what am I looking for even.
Most probably you are looking for this part of the docker documentation. It explains how docker compose is treating network. Part of particular interest for you is this:
By default Compose sets up a single network for your app.
Each container for a service joins the default network and is both reachable
by other containers on that network, and discoverable by them
at a hostname identical to the container name.
Meaning that you should use service1 and service2 instead of localhost to target across services.
All the services declared in the docker-compose.yml file are running in their own container. They have different ips. You can address them with their service name that will resolve to the service ip. In your case:
docker-compose exec service1 ping service2
or
docker-compose exec service2 ping service1
You should define a network and use the name of the service instead of localhost:
version: '3'
services:
service1:
image: services/services1
ports:
- 3000:3000
links:
- "service2"
depends_on:
- service2
networks:
- mynet
service2:
image: services/service2
ports:
- 8000:8000
networks:
- mynet
networks:
mynet: