MariaDB access for Docker containers

Currently reading
MariaDB access for Docker containers

13
1
NAS
Synology DS218+
Operating system
  1. Windows
Mobile operating system
  1. Android
Hi,
I'm having general issues connecting my docker containers to MariaDB 10 (installed through Synology packages center, version 10.3.21-0063).

For example, with the great tutorial from wwwampy, when I put the variables for database (LAN IP from NAS with port 3307), it fails to connect. I also tried with "localhost" / "127.0.01". I've already created the database and user with phpMyAdmin.

On the otherside, I was able to connect Nextcloud (webstation version) with LAN IP address and port to MariaDB 10.

I feel like I'm missing something. Would someone be nice enough to help a newbie ? :D

Thanks in advance et stay healthy
 
Thank you for your answer.

For Nextcloud, I use port 3307
'dbname' => 'nextcloud2',
'dbhost' => '192.168.1.156:3307',
 
Then I guess DB is broadcasting on port 3307 on your nas and docker containers should pick it up without any problem.

What container are you trying to run? Firefly?

If so, then make sure that the DB_HOST variable is configured not just with the ip address of the DB host (in your case that's your NAS IP) but also the port. So just like with dbhost parameter for nextcloud, use IP_ADDRESS: PORT as a value.

Also, Firefly can use 2 more variables if setting up a specific port as a variable is needed.

DB_CONNECTIONmysql
DB_PORTport number
 
I tried with IP:PORT with no success. I thought this was an easy fix but it doesn't seem so. So I resorted in creating a new MariaDB database with docker and connected through docker bridge. And now it works. My only fear is that i've seen that docker bridge IPs change when I restart the NAS.
Thank you for your help ! :)
 
Had the same issue, I resolved it by choosing "Host" for network instead of "Bridge". if you already have the container created, you have to delete and recreate again.
 
By default the MariaDB package only allows root access from localhost/127.0.0.1. This is why it works with mode=host and did not with mode=bridge. In mode=host the container shares the namepsace for the network device with the host (read: behaves network-wise exactl like the host). Btw: you can set and/or see the port in DSM's MariaDB configuration ui.

If you want to connect a container in the bridged network, you might want to read this link: Question - MariaDB 10 Error: 2006 MySQL server has gone away
 
By default the MariaDB package only allows root access from localhost/127.0.0.1. This is why it works with mode=host and did not with mode=bridge. In mode=host the container shares the namepsace for the network device with the host (read: behaves network-wise exactl like the host). Btw: you can set and/or see the port in DSM's MariaDB configuration ui.

If you want to connect a container in the bridged network, you might want to read this link: Question - MariaDB 10 Error: 2006 MySQL server has gone away
Ah that makes sense. Thanks mate!
 
I registered and want to post this for the sake of anyone who might come along looking for answers like I was. I have been trying to set up Firefly III in a Docker container with the MariaDB package running on directly on DSM. Aside from the noted suggestions above, Docker was unable to access MariaDB because the default new user made in phpMyAdmin is just for localhost.

The idea came from this thread: MariaDB access for Docker containers

Anyway, I hope that helps anyone coming behind me.
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Similar threads

You can run cmd.exe to get a command window from which you can execute SSH commands. However, my personal...
Replies
36
Views
2,997
  • Solved
I haven't thought about it as a file system level cache. If it is, it would make sense that both benefit...
Replies
8
Views
3,741
I'm not sure why I get that 172.17-address or if there's a way to change that...?
Replies
20
Views
6,136
Frustrating indeed. I will read further and try to discover what is all about. Thanks for your sincere...
Replies
20
Views
8,341
  • Question
You could register it inside Docker UI - Setup a docker registry on Synology
Replies
5
Views
5,969

Welcome to SynoForum.com!

SynoForum.com is an unofficial Synology forum for NAS owners and enthusiasts.

Registration is free, easy and fast!

Back
Top