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

How do I amend the default configuration of a mysql service in BitBucket Pipeline?


I've got the default mysql container running in our Bitbucket Pipeline. When running our db level unit tests, we are getting some errors due to a difference in configuration between the default image being used by Bitbucket's Pipeline and the configuration we run locally and in production.

Out of the 2,500 or so tests, we have 4 actual failures (the code has changed, the tests fail, so this is a good thing at the moment) and an additional 113 errors. The 113 are not present when/if we run the tests locally or in our production environments.

According to the Docker Hub image documentation ( and see "Using a custom MySQL configuration file") I can see that I could mount my my.cnf file into the container, but I do not know how to do that for the Bitbucket pipeline.

The Bitbucket documentation ( is a bit vague on this and simply refers to the Docker Hub image documentation (see previous link).

When running the mysql container inside Bitbucket, it makes no mention of loading any config at all.

At this stage, I'm not sure where to go next.

Any help would be appreciated.


2 answers

1 accepted

1 vote
Answer accepted

Hey @Richard Quadling,

Pipelines Service containers do not support mounting in any volumes at this time, so you have 2 approaches to solving this.

1) Keep using Service Containers, but fork and customise the community mysql image. You could even use a scheduled pipeline to do this for you.

This involves creating a new Dockerfile; eg.

FROM mysql
ADD ./mysql-configuration.cnf /etc/mysql/conf.d/

and a pipeline.yml like:

  custom: # Pipelines that can be scheduled or triggered manually
    update-mysql-image: # The name that is displayed in the list in the Bitbucket Cloud GUI
      - step:
- docker login --username $DOCKER_USERNAME --password $DOCKER_PASSWORD # assuming you've created a Dockerhub Account - docker build -t "richard_quadling/mysql:latest" . # assuming the Dockerfile is in the root.
- docker push richard_quadling/mysql:latest # push the image to Dockerhub
- docker

 2) You can use the Docker service to start the mysql service yourself, mounting the configuration, just as you would locally.

      - step:
- docker run --name some-mysql -v $BITBUCKET_CLONE_DIR/mysql/conf.d:/etc/mysql/conf.d -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag # Assuming your configuration is located in /mysql/conf.d in your repository
- # the rest of the build
- docker

which allows you to manage all aspects of the mysql engine, but requires you to manage the service lifecycle, monitor it, and extract any logs as part of your build process.


Hope that helps,


Posted wrong answer.
Please remove this.

Suggest an answer

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

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,741 views 10 16
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