That’s what I do. I always thought I was doing it “wrong” but it just made sense to me. I can also just up/down/etc… compose files to individually pull new images, test things, disable a service, and apply config updates without affecting another container at all.
I even keep my docker config files in a seperate directory so I can backup the docker composes in a second over the network.
I started by using a single mariaDB instance with multiple databases, but now I see the same benefits from moving to one database container per compose file that needs it to make it even more flexible so I don’t need to start up mariadb and redis before all of my containers.
File permission problems? Down the compose that needs it, fix it, re-up it without losing any uptime for other services and never having to use docker commands kludged together.
antsu@lemmy.wtf 1 year ago
This. And I recently found out you can also use
includes
in compose v2.20+, so if your stack complexity demands it, you can have a small top-level docker-compose.yml with includes to smaller compose files, per service or any other criteria you want.docs.docker.com/compose/…/include/
Lasso1971@thelemmy.club 1 year ago
I prefer compose merge because my “downstream” services can propagate their depends/networks to things that depend on them up the stream
There’s an env variables you set in .env so it’s similar to include
The one thing I prefer about include is that each include directory can have its own .env file, which merges with the first level .env. With merge it seems you’re stuck with one .env file for all in-file substitutes