It’s easy to get race conditions with & . Take for example, if you have a common pattern when you have the application server depends on the database, but since the database server didn’t have time to configure itself and application has already started it would just failed connecting for it. Compose Docker A race condition example with app & : NodeJS MySQL To build the application container, I used the following : Dockerfile To deploy the stack, I used docker-compose Let’s build the image: docker-compose build Then, create the containers: docker-compose up -d Let’s see the status: docker-compose ps The application failed to start, lets see why ? docker-compose logs -f app The application container come up before the DB and tried to connect to database and fail with a database connection error. To avoid that, There are many solutions: RACE CONDITION ! MySQL Adding a mechanism in the code to wait for DB to be up and setup before starting to connect to it Using policy — restart Docker Docs Holding the container until the database is up and running I will go with the 3rd solution, an open source tool called , the advantage of this tool is that’s its pretty fast to just look over the opening the socket until it’s getting open and then launch the web app. Dockerize Note: Dockerize gives you the ability to wait for services on a specified protocol ( , , , , , and ) file tcp tcp4 tcp6 http https unix So just update the to install : Dockerfile Dockerize Then, build the new image: docker-compose up -d docker-compose ps docker-compose logs -f app It’s working ❤