Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

docker-compose, mysql and bitbucket pipelines - how to make them play nicely


I have a build step which

  • Installs docker-compose
  • runs docker-compose up to create
    • an api, connected to a
    • mysql container
    • test runner (newman container which calls the API)
  • Installs test data into the mysql container
  • runs a docker exec command on the test runner to kick off the tests against the api

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, but that doesn't work for a containerised app, as it has its own idea of what 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


1 answer

1 accepted

2 votes
Answer accepted

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.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Confluence

New page sharing experience, coming soon to Confluence Cloud

...eans the lock icon is going away, you’ll find all of the lock icon’s functionality in the new Share button.  More visibility into a page’s true access No more uncertainty around w...

31 views 0 4
Read article

Community Events

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

Events near you