Migrate database to SQL / Docker


I have 2 docker containers (Nextcloud + Mariadb).
I have set up Nextcloud with sqlite, now I want to migrate to sql mariadb, but impossible to communicate with my database.
ANY help is welcome. Sorry but I’m learning this.
Everything is on the picture below.

Thanks !

there are two problems in my opinion:

  1. OCC-commands have to be run as www-data as stated here. I guess you are using docker-compose. That would mean docker-compose exec --user www-data app php occ ....

  2. Your database is running in a different container as your nextcloud app. So you have to use db (the service name of your MariaDB container) as hostname since IPs of Docker containers are dynamic but Docker provides some kind of DNS mechanism. localhost cannot work because you stay in the nextcloud docker container and the local IP of your server because Docker is blocking all unmapped ports from the outside.

I hope that helps.

Yours, DerFetzer


That was exactly my problem ! I understand it know. THANK YOU