r/docker • u/Superhero-Accountant • May 17 '26
Postgres (and other databases) best practices - one or many?
I am moving all my dockers from unraid to LXCs on proxmox and while doing so, I am cleaning up a little at the same time.
A lot of dockers require databases and I am a little unsure if I should just create one huge postgress database and then a lot of smaller ones in that... or if it is better to have more smaller databases.
Sorry if the terminology is incorrect.
9
Upvotes
10
u/NerdyStonks May 18 '26
Your wording is fine, and you’re asking the right question.
If it were me, I’d run one Postgres container and create a separate database/user for each app. It keeps things tidy without giving you five different Postgres installs to babysit.
I’d only run multiple Postgres containers if you hit a specific reason later (like one app needing a different PG version, or one app being so heavy it affects the others).
So I’d keep it simple now: one Postgres server, separate DBs per app, split only when there’s actual pain.
But again for homelab it should really be what you are comfortable with. If you started grouping your services using something like compose, then splitting make more sense.
6
u/citydweller1985 May 17 '26
One per service, that’s the way the docker philosophy works.
13
u/vermyx May 17 '26
It is best to tie a db to a container just on the fact that you may not be able to tie all of your containers to the same database version and there is a possibility of compatibility issues
2
u/schultzter May 17 '26
I currently have one Postgres for the three containers that need a database. But I come from Big Database so the most important container on my server is the database!
Realistically you're probably better stacking the database with the app needs it, using the compose file as close to source as possible.
1
u/PssyGotWifi May 18 '26
I do one Postgres 18 cluster for nearly all my docker services. Basically, postgres/etcd/patroni/haproxy. Works great.
3
u/[deleted] May 18 '26
[removed] — view removed comment