Barry
Barry

Reputation: 396

Docker-toolbox mariadb container

I am using docker-toolbox in Windows 8.1 and I have created a docker-machine (virtual box) named default and am running a mariadb container inside it.

My issue is, that I can not connect to said database system via HeidiSQL on my windows System.

Inside the docker container I am able to use the mysql command and execute queries.

Steps I have done so far:

  1. Add port forwarding inside virtual box:
    https://i.sstatic.net/IcXTJ.jpg

  2. change chain forwarding firewall rule to accepting
    Prove: https://i.sstatic.net/6uMKO.jpg

  3. Tried connecting to the database system in windows through heidisql with ip "localhost", "127.0.0.1" and the ip i get through "docker-machine ip default"

  4. Connected to docker container through "winpty docker exec -it mariadb bash" to check for firewall issues, but everything was accepting there.

  5. Made sure that the line "#bind =127.0.01" was commented out inside /etc/mysql/my.cnf

I really don't know what to do anymore to locate the issue. Mariadb logs just say that it is ready for connections, but I seem to not being able to reach it.

Any idea how I can track down the issue?

Upvotes: 1

Views: 313

Answers (1)

Barry
Barry

Reputation: 396

I solved it. The issue was that my command to run the container was missing the -p option, making my container not bind to a proper port(?).

Working command:

docker run --name mdb -e MYSQL_ROOT_PASSWORD=admin_password_here -p 3306:3306 -d mariadb/server:10.1

On top of that i noticed that changing port forwarding options inside your VirtualBox reqires a restart of said machine:

docker-machine restart default

Finally make sure that the bind adress line is commented out. I tried binding it to different adresses, but without leaving it commented out definitly works:

#bind =127.0.0.1

Upvotes: 1

Related Questions