Containerizing microservices
Containers are software packages that contain all parts to run in any environment. For example, a containerized version of the Django subscription app looks like this:
Figure 8.2 – Docker container and dependencies
The container virtualizes an operating system and enables memory, ports, and a virtual Python environment with the required packages for the Django app. Together, they form an isolated software package that runs on any host platform that supports Docker. So, we can quickly run the same container on Linux or Windows but also Azure or AWS.
To bring out the benefits of containers, it’s best to have only one software package per container. You could have an app and, for instance, a PostgreSQL database running in the same container, but then you have the mutual risk of interference, which decreases the reliability. So, it’s best to give the app and the database its own containers and connect them...