I’m not sure if this is the right place for this question, but I’m happy to redirect to the correct place if it isn’t.
I have three repos my team does work in, and each deploys separately. They all have the same basic
docker-compose.yml structure (an
app container running a django app that references and connects to a postgres database on a
db container, etc).
Each deployed repo has some intercommunication in production that we’d like to test in dev. I’ve built an override
.yml file for each project for the purpose of deploying them all onto a common docker network so they can communicate. Each override yaml adds a
container_name to each service in each project and referenced both a service’s original and override when calling
docker-compose up/run/exec, in hopes of allowing me to deploy all three in a centralized way.
docker-compose -f path/to/common-service-network.yml -f path/to/original-service-a.yml -f path/to/service-a-override.yml run --service-ports -rm -d app python manage.py runserver 0.0.0.0:8000
docker-compose -f path/to/common-service-network.yml -f path/to/original-service-b.yml -f path/to/service-b-override.yml run --service-ports -rm -d app python manage.py runserver 0.0.0.0:8000
However, when I try to run the above, they step on each other’s toes. The first
docker-compose command seems to do just fine. The second one doesn’t launch its
redis files, and django throws the following error:
django.db.utils.OperationalError: could not translate host name "e2e-service2-db" to address: Name or service not known
Is there something I’m missing for how to make this work?