Docker Community Forums

Share and learn in the Docker community.

Circular dependencies allowed with Docker Compose?

docker

(Kingdaddyfreshness) #1

Hello,

pretty new to Docker and Docker Compose. Have been able to use Docker Compose to create a multi-service application - but ONLY if those services communicate with one another in a “non-circular” manner. Here’s what I’m trying to do - and how I’m trying to do it:

What I’m trying to do: - I’m trying to create an application that is made of up web service “ServiceA” and web service “ServiceB”. ServiceA calls ServiceB. No problem using “links” attribute in docker-compose.yml file - this works great. However, ServiceB also needs to be able to call ServiceA. Now, using “links” attribute, I get a circular dependency error.

I assume that a circular dependency is allowed via Docker Compose but I’m just not using the proper technique? Anyone have pointers to a docker-compose.yml file that makes this happen?

Thanks!

-john


(Anoop) #2

For your use case it is recommended to use the networking api insider docker-compose instead of links.

Please refer to the link below for additional info on how to configure them:


(Dvohra) #3

Also refer