DEV Community

Discussion on: Wait for MongoDB, Postgres or MySql to start on Docker

Collapse
 
anselmobattisti profile image
Anselmo Battisti

Now there is another way to do it!

You can use healthcheck!

services:
app:
build: .
command: npm start
ports:
- "8080:8080"
volumes:
- .:/usr/app
networks:
- express-mongo-network
healthcheck:
test: ["CMD", "curl", "-f", "mongo:27017"]
interval: 30s
timeout: 10s
retries: 5