Please be aware that this is an old post, more than one year old, so you might need to look for an updated version of this article either on this site or using your favourite search engine.
I have been reading lately (again) a lot of articles which try to explain to the developers how to use
Docker for development, now they are all good (in general), each try to make simple and
easy for you to move and use docker, and everyone advice you to use
links (but remember
a legacy compose item so with Docker 1.13 you should use
both some how works the same, except that
depends_on will give you the ability to define the order which your images
so if we have the following images :
depends_on you can tell PHP to start after mySQL and Redis not before them.
This is really really nice, but its not enough.
as noted in the documentation(https://docs.docker.com/compose/compose-file/#/dependson) :
depends_onwill not wait for mysql and
redisto be “ready” before starting
php- only until they have been started. If you need to wait for a service to be ready, see Controlling startup order for more on this problem and strategies for solving it.
So I guess now you got the point, you can control the order of the starting process, but you cant be sure if the service is ready or not, I'll tell you how I do that but this is a topic for another post.