Docker Community Forums

Share and learn in the Docker community.

How to deploy multiple stacks and/or multiple database-services on one stack?

I have been fiddling around with docker-compose and a reverse-proxy service. I am fairly new to all of this docker and docker-compose bussiness.

I have portainer which helps me visualize and manage certain things.

I have a stack called “proxy” which contains nginx-proxy and letsencrypt in order to reverse proxy services on my domain to the correct subdomains. I revently installed wordpress with mysql8.0 container and when I tried to use nextcloud with mariadb the wordpress lost the ability to connect to the database. It seems that I can only have a single database container on one docker-compose file/project/directory.

Am I able to somehow create a new project/stack/directory which only houses nextcloud and mariadb yet still connect them to the proxy stack so it can be accessed via subdomain.domain.tld?

Portainer “Proxy” stack: portainer-proxy-stack — ImgBB

I don’t understand why the two database containers would cancel one and only allow one of them to work. The only solution I can think of would be to seperate the stacks. Or am I missing the fact that I could create multiple databases using one mysql8.0 container?

This is all rather confusing for me since in the past I would use shared-hosting and mysql access to databases. Docker is fairly new to me and I love it but this is also my first time crreating a self-hosted stack to run multiple software packages such as cloud storage, rss reader, website, etc all on one domain using reverse proxy(which I have never used before.)

I can’t say that I share your conclusion regarding the database.
Please share the compose configuration that led you to this conclusion.

Two more things:
– You might want to take a look at Traefik, as it allows to setup reverse proxy rules using labes on the target service (use container labels for docker-compose deployments and service labels for docker stack deployments).
– Since nextcloud is no dependency of wordpress (or the other way arround), would it make more sense to seperate them into their own compose files?