When using docker-compose, even if one service is marked as depending on the mysql service, the first service is started before the initial DB init is complete - and it is then unable to initially connect to the mysql service, causing errors:
https://github.com/docker-library/docs/tree/master/mysql#no-connections-until-mysql-init-completes
It would be good to add to the documentation at that link with a couple of suggested workarounds, eg using mysqladmin ping (example) or nc (for when mysqladmin is not available; slightly over-complex example) - to save everyone from having to reinvent the wheel :-)
When using docker-compose, even if one service is marked as depending on the mysql service, the first service is started before the initial DB init is complete - and it is then unable to initially connect to the mysql service, causing errors:
https://github.com/docker-library/docs/tree/master/mysql#no-connections-until-mysql-init-completes
It would be good to add to the documentation at that link with a couple of suggested workarounds, eg using
mysqladmin ping(example) ornc(for when mysqladmin is not available; slightly over-complex example) - to save everyone from having to reinvent the wheel :-)