MySQL container not building fast enough


I’ve got an interesting case now. CircleCI builds are so fast now, that sometimes the connected MySQL container doesn’t build fast enough, and then things fail due to a connection refused error. Is there a way to get the MySQL container to build and connect faster? Or a more intelligent way than sleep(x) to make sure it’s ready before connecting.


Dockerize or netcat are the two best options.

dockerize -wait tcp://localhost:3306 -timeout 1m
nc -z 3306


Hmmm not sure if Laravel would be able to work with this. The error happens when Laravel goes to connect to the MySQL host to create and seed the database tables.


You just need to have this command prior to your composer migration.


Ahh got it, sorry didn’t get that. Let me update the build config and try it out


No worries :slight_smile: That’s why we have support


Quick update to our docker image to add those commands, and that seems to be working now. Thanks for the tip!


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.