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.
Hope this helps someone. It took me forever to figure this one out.
We are excited to announce the open beta program for self-hosted runners. Bitbucket Pipelines Runners is available to everyone. Please try it and let us know your feedback. If you have any issue...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events