Ralph
Ralph

Reputation: 4868

One or Many Docker Containers for MySQL/PostgreSQL?

I plan to build a docker environment running several business applications. Each application need a separate database. My question is:

Is it recommended to start a separate database container (e.g. mysql or postgres) for each application container? Or should I run only one database container and install several databases in it?

Is a docker-host with multiple mysql containers - each with one database - wasting CPU or memory?

Upvotes: 2

Views: 948

Answers (2)

Jay Dorsey
Jay Dorsey

Reputation: 3662

I would suggest using a separate container for each database, even in development. Using docker-compose this becomes relatively trivial

Upvotes: 0

Bukharov Sergey
Bukharov Sergey

Reputation: 10185

Docker way is using separate and independent environment for each service. if you will use separate database for each application you can

  • update DBMS independently
  • make flexible scaling
  • independent backups(with Extrabackup as example)
  • you can completely brake one of databases and another applications will works fine.
  • and so on.

But in development environment you can use single container for all databases.

Upvotes: 2

Related Questions