Just as a note, because I was looking for an answer for a few hours. Usually, your image wont have mysql-client, so you cant connect to the service out of the box. It would be nice to have this kind of information anywhere in documentation, because its not really that obvious
Just install it:
apt-get --assume-yes install mysql-client
and then you can connect, remember the host is “mysql” not localhost
mysql -h mysql -u root -p somefancypassword
During the runner register you can say which image you want to use. Or you can define the image within the .gitlab-ci.yml file at the top of the file. Like so:
image: mysql:5.5
or atleast take a look at this docker file to create your own Docker image: