docker-compose with condition (healthcheck)

Hits: 242

services:
server:
    depends_on:
      db_server:
        condition: service_healthy
  db_server:
    ....
    healthcheck:
      test: mysqladmin ping -h 127.0.0.1 -u root --password=$$MYSQL_ROOT_PASSWORD
      interval: 5s
      retries: 5

Thanks for Blog Post : https://www.bornfight.com/blog/blog-lamp-docker-setup-with-php-8-and-mariadb-for-symfony-projects/