Owncloud docker install with external mysql or mariadb non-default port

Steps to reproduce

Expected behaviour

Trying to install latest owncloud server docker container, with environment settings for external mysql/maridb instance on non-default port: OWNCLOUD_DB_HOST= (which is docker container running mariadb on non-defalut port)

Actual behaviour

First start keeps waiting for mysql, and restarting without being able to make (first) connection to create tables.

Server configuration

Operating system: Ubuntu.x86-64

Web server:
latest docker container 10.5
mariadb 10.4

PHP version:
latest docker container 10.5
ownCloud version: (see ownCloud admin page)
latest docker container 10.5
Updated from an older ownCloud or fresh install:
Where did you install ownCloud from:
docker hub
Signing status (ownCloud 9.0 and above):

Login as admin user into your ownCloud and access 
paste the results into https://gist.github.com/ and puth the link here.

not available yet

The content of config/config.php:
not available yet

Log in to the web-UI with an administrator account and click on
'admin' -> 'Generate Config Report' -> 'Download ownCloud config report'
This report includes the config.php settings, the list of activated apps
and other details in a well sanitized form.


If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

*ATTENTION:* Do not post your config.php file in public as is. Please use one of the above
methods whenever possible. Both, the generated reports from the web-ui and from occ config:list
consistently remove sensitive data. You still may want to review the report before sending.
If done manually then it is critical for your own privacy to dilligently
remove *all* host names, passwords, usernames, salts and other credentials before posting.
You should assume that attackers find such information and will use them against your systems.
not available yet```

**List of activated apps:**

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.

**Are you using external storage, if yes which one:** local/smb/sftp/...
local disk
**Are you using encryption:** yes/no

**Are you using an external user-backend, if yes which one:** LDAP/ActiveDirectory/Webdav/...


Which docker container are you using? Did you build your own?
If you’re using docker-compose you should be able to use the following command to exec into the container:

  1. docker-compose exec owncloud entrypoint bash
  2. Now you’re root inside the container and you can print the environment variables with env
  3. env | grep -i db I was able to confirm that with that parameter set in my docker-compose.yml the variable was set in the environment and ownCloud was waiting for MySQL/MariaDB to become available on that port. (I didn’t have a container available atm where I could reconfigure the port quickly)

Finally you should also be able to run the mysql command inside the official ownCloud docker container and test your connection string like that.

1 Like

Hi, you are correct. I am using the official owncloud/server container. But further troubleshooting indeed shows the issue lies somewhere else: my docker container for owncloud on nas seems unable to connect to docker database containers on same nas…
I did not expect that. Stupid me. Mysql connection to a container on a different cluster does work.

Thanks for pushing me back on track and apologies for the inconvenience.

Edit: Now works. I needed to define another network to be able to share the connection.

1 Like

Yes, this is the default behavior of docker. You have to create a docker network and add both containers to it, so they can talk to each other.

I didn’t realize your MySQL/MariaDB container was a container as well as it has a very docker untypical IP address.

1 Like