I have two separate docker containers, each running an api (auth_api and user_api).
I am trying to make a get request from the user_api service to the auth_api service but it fails with this error: curl: (6) Could not resolve host: auth_api
These are my docker-compose files:
/auth
version: '3'
services:
auth_api:
build:
context: .
command: uvicorn main:app --host 0.0.0.0
ports:
- "8000:8000"
networks:
default:
name: shopnet
external: false
/user
version: '3'
services:
user_api:
build:
context: .
command: uvicorn main:app --host 0.0.0.0 --port 8001
ports:
- "8001:8001"
networks:
shopnet:
external: true
The shopnet network is created because it shows up in the list: docker network ls
I am executing the GET request with curl directly from the user_api container:
curl http://auth_api:8000/auth