Hi,
I’m trying to connect my Nextcloud container to an external MySQL Database.
I can create the container with docker-compose and also access the setup page from Nextcloud, but I’m not able to connect to my existing database which I created with VESTAcp.
I guess MySQL and Docker cannot communicate together, but I have no idea why. I (hopefully) changed the MySQL bind address to the IP Range 172.0.17.0\16 to connect them together, but I have no idea if this is the right way.
I attached my docker-compose.yml.
Thanks for helping!
version: '3'
volumes:
nextcloud:
database:
services:
database:
image: mariadb
restart: always
container_name: mariadb_container
volumes:
- /var/lib/mysql/:/var/lib/mysql/
app:
image: nextcloud:fpm-alpine
restart: always
volumes:
- nextcloud:/var/www/html
container_name: app_container
links:
- database
environment:
- MYSQL_ROOT_PASSWORD=testrootpasswort
- MYSQL_PASSWORD=testpasswort
- MYSQL_DATABASE=admin_nextcloud
- MYSQL_USER=admin_nextcloud
- MYSQL_HOST=localhost
depends_on:
- database
web:
build: ./web
container_name: web_container
restart: always
ports:
- 8080:80
volumes:
- nextcloud:/var/www/html:ro
depends_on:
- app