Configuring MariaDB in a container for Remote Client Access


I’m trying to access a MariaDB running in a Docker container that is spun up on a VM created via Docker-Machine & Virtualbox with J-Meter.

I can do this task locally where both the jmeter and mariadb are installed on the same node.

However, remotely, trying to access the DB in a container and running a JMX file locally seems to not work for me.

Can anyone help please?


Please post a minimally reproducible example, or else we won’t be able to help.

Hi Nathan,

Please find attached example as requested in order to reproduce the issue. (It wont allow me attach anything, ill send it to you via email!)

Having another issue from your site too regarding Seamless Docker Multihost Overlay Networking on DigitalOcean With Machine, Swarm, and Compose ft. RethinkDB

Please see my comment in the comment section.

@pedro47, I have remote connection from a mysql client on my OSX machine working to a container inside the Docker Machine VM, here’s what I did to get it to work.

  1. I docker cp-ed the /etc/mysql/my.cnf from an existing container and baked a new image with following the instructions to remove skip-networking and bind-address line indicated here:

  2. As also indicated by that link, once I ran the container with the new configuration image I did a docker exec and ran some SQL to grant privileges to root user enabling remote connection. SELECT User, Host FROM mysql.user WHERE Host <> 'localhost' indicated a root user allowed to connect from everywhere, so I followed up with:

  3. Then, I was able to connect with MariaDB client on my Macbook. The port is arbitrary due to my use of docker run -P but you should be able to connect to 3306 if that’s the one you’re exposing.

$ mysql -h $(docker-machine ip) -P 32768 -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 11
Server version: 10.1.13-MariaDB-1~jessie binary distribution

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
| Database           |
| information_schema |
| mysql              |
| performance_schema |
3 rows in set (0.00 sec)

MariaDB [(none)]>

Remember, this will expose the database to connection from all places, you should be careful to lock this down more carefully if you end up moving it into higher environments.

1 Like


Thank you for the reply!

I eventually got it to work!

Your guidance was a huge help in me finally getting this to work!!

Thank you very kindly

Much appreciated


1 Like

Glad to hear it worked out @pedro47!

1 Like