I am implementing a simple setup with two micro services and would like each of them to have their own DB - each service is running in it's own container. Should i include the DB's in each service container (so each container will contain the service application + DB with a total of two containers), or should i create a new container for each DB (with a total or four containers)?. Given the fact that each DB is used only by one service, it seems cleaner to encapsulate the Service+DB in a single container which will be the overall service. On the other hand - deploying a DB as a container is much simpler and faster than combining it with the application container.

1 Answer 1


Keep the DB containers separate. The concept of microservices and containers is to allow each part to be independently updated without introducing changes and outages to the rest of the application stack. Containers should also be running a single app per container to allow error detection and log gathering from that application. Each container is simply an isolated process, so unlike a VM, there's little overhead on the host to split each of these out.

Your Answer

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

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