Install the app
How to install the app on iOS

Follow along with the video below to see how to install our site as a web app on your home screen.

Note: This feature may not be available in some browsers.

Question Why put phpMyAdmin and MariaDB in a Docker?

253
35
NAS
DS918+
Operating system
  1. macOS
Mobile operating system
  1. iOS
I've worked out how to install Nextcloud using Docker. I want to reinstall and use MariaDB rather than the 'built-in' SQLite which comes with Nextcloud. MariaDB and phpMyAdmin are available as Synology packages. But I see folk here recommending to use them via Docker, to have three containers, Nextcloud, MariaDB and phpMyAdmin.

Why?

Why not use a containerised Nextcloud with the Synology phpMyAdmin and MariaDB?

Because containers are better? In which case should I containerise all my apps, as that's the logical conclusion!
 
I still struggle a lot with Docker cuz iam a noob. But if I had to make a choice, I like running stuff in Docker better cuz you then have more control what the app does. I do see many advantages if these containerized stuff in terms of configuration and isolation.

Plus, I think synology is trying to put a clamp down on 3rd-party apps on a NAS. So even from synology there is a preference to run 3pre-party apps in Docker so they can continue develop DSM without strings attached.
 
Just like @Shadow said it. Looking for the past 10y or so, Syno is known to kill its own apps and replace them with new ones (Photo Station, Moments, Photos, Time Backup to name the few). Towards 3rd party apps there was also a sort of "hostile" point of view especially with apps that they moderated and placed in the Package Center. Since 2015 and Docker introduction to Syno platform things are moving more and more in that direction. Considering that now they have to maintain one platform that will in return be able to run any number of open source apps (that they don't have to maintain), it's a win win for everyone. Also, the Docker platform can offer you, as Shadow said, isolation and better control. This way if, at some point, you decide to move away from Syno platform, you can simply migrate your existing docker containers to another vendor all supporting docker.
 
Thanks @Shadow and @Rusty, I think I'll containerise! Interesting politics there but as long as they keep looking after the core NAS environment and let me make use of the Linux underneath I should be happy.

Now, you do realise you're going to have to answer my super noob questions about getting the three containers to work nicely together. I have tried and failed :(
 
Now, you do realise you're going to have to answer my super noob questions about getting the three containers to work nicely together. I have tried and failed :(

I think we can try to do our best. :)

Now let's start with the first things. The first docker that should be created and running is MariaDB.

- Have you got it running?
- If no, what is happning? Do you get an error? Post screenshot if possible.
- Please share the container configuration, like the 'docker run' or 'docker create' command you used.

Same goes for PHPMyAdmin. I've felt the pain...
 
The first docker that should be created and running is MariaDB.
You know what, I only just discovered that a minute ago by RTMF for phpMyAdmin. Off to a better start than yesterday :)
- Have you got it running?
How will I know? It kinda sits around in the backgroound. Until I get phpMyAdmin running I won't be able to tell other than what Docker says.

Also, why do I need phpMyAdmin? Doesn't MariaDB create a database on first run which I can then have Nextcloud use? I'll go and RTFM a bit more.
 
How will I know? It kinda sits around in the backgroound. Until I get phpMyAdmin running I won't be able to tell other than what Docker says.

In my case, if I see it in a running state and the logs look OK'ish, that did it for me. The more advanced amonst us could probaly query the database against port 3306 to see if it's really working..

Also, why do I need phpMyAdmin? Doesn't MariaDB create a database on first run which I can then have Nextcloud use? I'll go and RTFM a bit more.

Well, you don't really need it... PHPMyAdmin is basically a (rich) user interface that you can use to view and manage MariaDB and MySQL databases. It definitely has benefit for those less advanced skillz with database management (like me).
 
It definitely has benefit for those less advanced skillz with database management
Also, it can provide a UI to setup up multiple DBs running in that once instance. @DeltaGolf MariaDB can host multiple DBs for various apps. In your case, NC will be the 1st one, but not necessarily the last one.
 
Well here's good news @Rusty & @Shadow, Nextcloud is up and running! :)

Obvs, a couple of hiccups on the way but it works. Here's my observations. I did all of this in the Synology Docker GUI. No command line trickery here.

MariaDB was installed first (thanks for the confirmation @Shadow) where I used the Environment Variable to create the MYSQL_ROOT_PASSWORD, a MYSQL_DATABASE, MYSQL_USER and MYSQL_PASSWORD for Nextcloud. Local Port 3306 points top Container Port 3306. I created a folder, docker/mariadb and added /var/lib/mysql to save the data there.

phpMyAdmin was a bit tricky but @Shadow's attempts helped out. All I added to Environment was the PMA_HOST and PMA_PORT. Local Port 8081 points to Container Port 80 and as yet - but do tell me if I should - I don't have the data being store in my Docker folder. phpMyAdmin seems to suggest any preference changes I make won't be saved, I guess thats why? After a couple of failed attempts I was able to log in using the MYSQL_ROOT_PASSWORD.

A bit harder to get Nextcloud going compared with yesterday when I had it first time (but using SQLite). At first I created folders in docker/nextcloud for the /data and /config. According to the Docker/Nextcloud docs I can add
  • /var/www/html Main folder, needed for updating
  • /var/www/html/custom_apps installed / modified apps
  • /var/www/html/config local configuration
  • /var/www/html/data the actual data of your Nextcloud
  • /var/www/html/themes/<YOU_CUSTOM_THEME> theming/branding
so that suggested I should also have docker/nextcloud -> /var/www/html in which case maybe I don't need to add docker/nextcloud/config -> /var/www/html/config or docker/nextcloud/data -> /var/www/html/data because Nextcloud creates lots of folders in docker/nextcould on first run. And that seems to have worked, I can see data for the Nextcloud user in that user's folder docker/nextcloud/data/user-one/files/Documents for example. So I'm slightly confused about which folders I need to create for a Docker install and which are created automatically. This ia all about 'mounting' folders and I've always found myself hard of understanding Linux mount points.

The only odd thing was that Nextcloud didn't install the recommended apps it offered and I agreed to, Calendar, Contacts, Tasks and a couple of others. But easily rectified.

My next task is to sort the reverse proxies. But before then I'd be happy to access Nextcloud at https://mynas.myserver.tld/nextcloud rather than by port number.
 
My next task is to sort the reverse proxies.
Well that didn't last long :(

I created a reverse proxy but Nextcloud moaned that it wasn't a trusted domain and I better fix that by fiddling with the config.php file. So - yea, I know, my mistake - I downloaded, edited the file and put it back. Making the further error of not saving or renaming the original. Now Nextcloud won't run cos it cant write to the config file. So I thoght, I'm smart, all I have to do is change the ownership of the file back to "33" like all the others. Nope, don't know how to do that.

So we'll take the easy way out, scrap that nextcloud and install a fresh one. Now, on startup where I create a user and set the database I get

"Error while trying to create admin user: Failed to connect to the database: An exception occurred in driver: SQLSTATE[HY000] [2006] MySQL server has gone away".

Now where am I?
 
Looks like NC can't see your SQL instance. How are you configuring this atm, exactly?
By chucking it all away and starting again. I'm following my notes from earlier but somethings not right. ATM phpMyAdmin can't log in to MariaDB. So it must be something I've done/not done in the database setup.
 
best to check maria container 1st.
I'm doing as I wrote above, earlier today. MariaDB is creating files in docker/mariadb, but only the defaul databases. No sign of the 'nextcloud' database I had earlier and I'm asking for in the Environment tab.

phpMyAdmin is saying

mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known

and

mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known

:(
 
I'm doing as I wrote above, earlier today. MariaDB is creating files in docker/mariadb, but only the defaul databases. No sign of the 'nextcloud' database I had earlier and I'm asking for in the Environment tab.

phpMyAdmin is saying

mysqli::real_connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known

and

mysqli::real_connect(): (HY000/2002): php_network_getaddresses: getaddrinfo failed: Name or service not known

:(
Not sure how people will help you with posting just errors. What the detail configuration of phpmyadmin and maria container atm?
 
What the detail configuration of phpmyadmin and maria container atm?
Here's MariaDB for the minute. To me this config says it will create a password for root, along with a database, database user and password. There is no sign of the database so I assume the root password failed as well.
Screenshot 2020-06-11 at 17.53.01.webp
Screenshot 2020-06-11 at 17.47.37.webp
 
Educated guess: created in the ui, without specifiying a link in the NC container for the database? This is required if you want NC to be able to lookup any other container by its name. If you create a custom network (regardless wether with the ui or with docker-compose) and attach you three containers to it, they will be able to resolve containers by their containername...
 
Ok thats maria. What about phpmy?
Educated guess: created in the ui, without specifiying a link in the NC container for the database?

We're jumping ahead here! I learned I have to get MariaDB running first, I did have, I deleted and reinstalled. When I reinstalled I asked for a root password, a database to be called 'nextcloud' along with a user and that users password.

So looking in the docker/mariadb folder we can see the nextcloud database wasn't created. My educated guess is that if that those environment variables weren't created neither was the root password. So when I do get to phpMyAdmin I can't login as the root password is wrong.

A quick RTFM and it says:
note that none of the variables below will have any effect if you start the container with a data directory that already contains a database: any pre-existing database will always be left untouched on container startup.

So I thought I had deleted everything, but Docker seems to think the database and variable already exist so doesn't recreate them?

I think l I need to delete all of the containers and all of the data and start afresh. I thought I'd done that, how can I be sure?
 

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.

Popular tags from this forum

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,259

Thread Tags

Tags Tags
docker

Welcome to SynoForum.com!

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

Registration is free, easy and fast!

Trending content in this forum

Back
Top