I have a build step which
Now, I have attempted to spin this up, by the mysql container fails when I try to install test data into it, because of the following error message is returned:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I am assuming this error message is related to the way bitbucket pipelines handles mysql as a service, so my container can't connect accordingly to the above socket.
I then read about spinning up a mysql service in my bitbucket pipelines step, which I did. I was able to get my sample data loaded into the local mysql database. However, as my containerised API needs to access this mysql instance for its data, I was unable to work out the correct way to make the API even find the step's mysql server to use as its data store. The mysql service runs on 127.0.0.1, but that doesn't work for a containerised app, as it has its own idea of what 127.0.0.1 means (aka itself).
1. Is it possible in any way to spin up my own mysql container as defined in my docker-compose file, and if so, how? If not
2. How can my containerised API access the step's mysql service, as this is running on 127.0.0.1?
Okay, I hope this helps anyone else. After scouring Atlassian's community and blog posts, I discovered some undocumented "features" to their mysql implementation, and how you can allow your docker-compose (or just plain docker) app to access the step's MySQL service.
https://medium.com/it-dead-inside/bitbucket-pipelines-docker-compose-and-database-hosting-9c81aa9311f3
Hope this helps someone. It took me forever to figure this one out.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.