So I have been reading up on Docker, and I cannot quite get my head around this concept. There are literally dozens of tutorials on the web about spawning a Wordpress instance on Docker within 5 minutes. All these sites spawn their processes separately; a singe SQL container, a single webserver container and a PHP + filesystem container.

Apparently the Docker philosophy is to keep everything nice and small and separated. Proper isolation, distribution and scalability; all fine. But what if I need two Wordpress sites, or ten?

The advantage of separate containers is that every site can be instantiated with its own passwords and other secrets via a docker-compose file, but having 10 database containers running next to each other feels like wasting resources. Once single SQL container should be capable of running 10 databases.

I was wondering if running multiple instances is indeed resource heavier, and/or if the added value of strict isolation outweighs the resource usage?

(I have chosen SQL, but the question basically applies to all resources that can be shared across sites. Think of mailservers, virus scanners, etc.)

1 Answer 1


Docker and all the other fancy names are just tools. The examples are just examples.

Resource-wise, Docker changes nothing much beyond usual Linx/Unix multiprocessing. It does not have the overhead of VMs, and little overhead over just starting the process directly ( https://stackoverflow.com/questions/21889053/what-is-the-runtime-performance-cost-of-a-docker-container ).

So it is really up to you to decide how to use it. If you have closely related applications under your own command, maybe in your intranet, why not use a shared DB. If they are customer DBs, or you might need to run different versions of the software, or different incompatible configurations, then separate services might be fine.

For RDBMSses especially, they are usually very good at managing resources (RAM, HDD) and so for this case specifically, running only one may just be the best thing. It's really more about what your needs are than general guidelines.

  • Yes I realized they were just examples, but unfortunately there were no examples of running multiple sites. I will make some list of requirements and decide based on that. Good to know that I should not rule out multiple DB containers to begin with. Sep 28, 2017 at 9:07
  • 1
    Yeah. One case where it is great to dockerize, say, PostgreSQL is for development and throwaway CI/CD environments. OTOH, I would not dockerize a heavy-lifting Oracle DB, probably...
    – AnoE
    Sep 28, 2017 at 17:58
  • What about MySQL, would you dockerize it and run an instance for each application or would you choose a shared MySQL server with multiple databases in it?
    – Sam
    Aug 19, 2020 at 11:11
  • @Sam, following the spirit of my answer, it would depend wholly on the use case. There are official MySQL docker images easily available; I would most definitely use them unless I had good reason against that (the latter being for example if I were a DBA running a huge dedicated DB installation used by many clients). OTIH, spinning up a quick MySQL service in a Kubernetes cluster? Sure... (be sure you know how to handle the persistent volumes...).
    – AnoE
    Aug 20, 2020 at 15:56
  • I was talking about a single MySQL container vs multiple MySQL containers. Is MySQL lightweight enough to run multiple MySQL containers? Each for its own application.
    – Sam
    Aug 24, 2020 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.