Docker Community Forums

Share and learn in the Docker community.

User defined bridge network and name resolution

Hi all

I built an image and the entrypoint has this content:

$ cat entrypoint.sh
#!/bin/bash
cd /var/www/html/fr && php bin/console doctrine:migrations:migrate -n
/usr/sbin/apache2ctl -D FOREGROUND

The “doctrine:migrations:migrate” command use to perform some database migration.
The target database is also a container, set on the same user defined bridge.

The problem is at the moment it is launched, the DNS resolution is not working yet, so that the command just fails with the MySQL host name not found.

If I put a “sleep 5” before, it is OK. But that workaround seems ugly to me: how do you manage to wait for the name resolution to be up?