Stateful versus Stateless Containers/Services
Containers and services can run in two modes: stateful and stateless. A stateless service is the one that does not retain persistent data. This type is much easier to scale and update than the stateful one. A stateful service requires persistent storage (as in databases). Therefore, it is harder to dockerize because stateful services need synchronization with the other components of the application.
Say you're dealing with an application that needs a certain file in order to work correctly. If this file is saved inside a container, as in the stateful mode, when this container is removed for whatever reason, the whole application crashes. However, if this file is saved in a volume or an external database, any container will be able to access it, and the application will work fine. Say business is booming and we need to scale up the number of containers running to fulfill the clients' needs. All the containers will be able to...