docker-compose handling circular dependency
In docker-compose
files you can have different keywords to indicate run time dependency.
depends_on
and links
. The latter one is for handling network connection.
The links
keyword is needed to handles how traffic is directed into one direction. depends_on
and links
can interfere with one another in terms of dependency. An error like this occurs when you want to run docker-compose up
Docker compose ERROR: Circular dependency between ....
It is an issue when depends_on
and links
disallowing the docker-compose
to start the service because different resources require a service to be running.
The general solution for this problem is to disabled the links
keywords and get the different services running first. In my understanding the depends_on
is
for the run time dependency. In sense what a service requires before it can be started:
A -> B -> C
In the sense: A requires B and therefor. But for the links
it’s the other way around. Who needs a connects to whom
C -> B -> A
best regards, akendo