Answer the question
In order to leave comments, you need to log in
How to point a dependency to another container in docker-compose?
Hello.
Hence the question is this. Example.
I have docker-compose with a database. I run it through one docker-compose file.
There is a second docker-compose file, where I must specify the dependency on this container with the base, and so that the second application can access it.
Please give an example. Thank you.
Answer the question
In order to leave comments, you need to log in
Common practice #1 is one docker-compose.yml and depends_on in the service config
Common practice #2 is many docker-compose.yml where services are federated via an external network (network: external). At the same time, the restart:always configuration is set for the service of the main application, so that it restarts until it sees the database.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question