4

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.)

Neograph734
  • 143
  • 5

1 Answers1

3

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.

AnoE
  • 4,936
  • 14
  • 26