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
5,011
There must be already be some sort of dependency, as the deluge service joins the network namespace of the...
Replies
6
Views
595
Ok got this running.. But how do I specify the custom_user/password settings in the yaml-file? EDIT...
Replies
7
Views
862
For the heck of it, I just checked again in docker container, and it announced an update was available. I...
Replies
4
Views
1,014
  • Question
Do realize, that enabling any user to run docker containers is largely the same as giving that user full...
Replies
6
Views
1,607

Welcome to SynoForum.com!

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

Registration is free, easy and fast!

Trending threads

Back
Top