I'm trying to do a zero downtime deploying w/ docker-compose and traefik, but I'm having issues with a container cross communicating with another project.
docker-compose.yml (details omitted)
services:
proxy:
networks:
- net
app:
networks:
- net
auth:
networks:
- net
networks:
net:
external:
name: traefik_webgateway # not really important here
I run two different instances of my services via:
docker-compose --env-file=.env --project-name=green -f docker-compose.yml up
docker-compose --env-file=.env --project-name=blue -f docker-compose.yml up
My services in "green" work fine until I run the "blue" project. When "blue" is being brought up, some of the requests in the "green" "proxy" container is being routed to the "blue" container. Example call being made in "proxy" to talk to the "auth" service:
http://auth/session
I need the networking in "green" to stay in "green", and "blue" in "blue"... otherwise some of the requests in "green" is going to "blue" when it isn't ready it causing API failures. Once all the containers are ready, everything works but this isn't zero downtime.
It looks like everything is bound by the container name. I don't want to use container_name
because I want to use the docker scale
.
My workaround is creating docker-compose.blue.yml
and docker-compose.green.yml
and duplicates everything but suffix the container name
with _blue
and _green
. But I'm wondering if there's a better solution.
Thanks in advance.
EDIT: The proposed solution answers the question, but by adding the internal
network to my proxy
, traefik loses communication with my service.