title: Docker-compose check if mysql connection is ready [version 3]
body: <p>I am trying to start one container after the MySQL one is initialized. </p>
  
  <p><a href="https://stackoverflow.com/questions/42567475/docker-compose-check-if-mysql-connection-is-ready">This was not an issue in docker-compose v2.1</a> In the version <code>3</code> of <code>docker-compose</code> the <code>depends-on</code> <a href="https://github.com/moby/moby/issues/30404" rel="nofollow noreferrer">doesn't have the <code>condition</code> statement anymore</a>.</p>
  
  <p>My current setup looks like this:</p>
  
  <pre><code>test:
      image: php:7.2
      container_name: second
      restart: on-failure
      depends_on:
          - mysql-test
  
  mysql-test:
      image: mysql:5.7
      container_name: first
      environment:
          MYSQL_ROOT_PASSWORD: secret
      healthcheck:
          test: ["CMD", "mysqladmin", "ping", "-psecret", "-h", "localhost"]
          timeout: 30s
          retries: 10
  </code></pre>
  
  <p>Of course, running <code>docker-compose up</code> and then executing script in the PHP container that is trying to connect to the database results in <code>SQLSTATE[HY000] [2002] Connection refused</code> since MySQL container is not ready yet.</p>
  
  <p>Is there a recommended approach to this problem in <code>docker-compose</code> version 3 or any kind of a workaround?</p>