MySQL starts on its own even after stopping the process

I am having some trouble with default MySQL installation on CircleCI. In ‘post’ section of ‘machine’, I stop mysql using, “- sudo service mysql stop”. The reason behind doing so is that I want to use docker mysql container on port 3306. My “docker-compose up” takes some time to finish and sometimes before the docker mysql container starts, the mysql process starts again for no reason obvious to me. I have been tracking this issue using the following command.

while true; do sudo netstat -nlp | grep :3306; sleep 2; done

I have a build that ran fine with docker being able to register port 3306, and also a build in which mysqld started again even after stopping giving me the following error on docker-compose up.

ERROR: for dbm01  Cannot start service dbm01: failed to create endpoint minimum_dbm01_1 on network minimum_default: Error starting userland proxy: listen tcp bind: address already in use
ERROR: Encountered errors while bringing up the project.

Both the builds are of same commit so there is no difference in code. What might be the issue?

What build image are you using?

Also, can you try moving the line to stop MySQL from machine: post to dependencies: pre and seeing how that works?

Thanks for reply. I am using mariadb:latest build. I tried moving the line to stop MySQL to dependencies: pre. The issue persists.
Moving it to dependencies: override just before the docker-compose up command doesn’t help either.

Sorry I meant which image are you using for CircleCI not Docker. This is in your “Project Settings”.

I couldn’t find the build image anywhere in “Project Settings”. But I have not chosen any build image, I am using whatever is the default.

I have the same issue with 14.04

What seems to be working for Postgres users is to stop the service in test/pre. Could you try that?

I fixed it with:

- export DEBIAN_FRONTEND=noninteractive && sudo apt-get remove -y --purge mysql-server mysql-community-server