Persisting stateful services on a Network File System

We need to find a way to retain state outside containers that run our services.

We could mount a volume on the host. That would allow us to preserve state if a container fails and is rescheduled on the same node. The problem is that such a solution is too limited. There is no guarantee that Swarm will reschedule the service to the same node unless we constrain it. If we would do something like that, we'd prevent Swarm from ensuring service availability. When that node would fail (every node fails sooner or later), Swarm could not reschedule the service. We would be fault tolerant only as long as our servers are running.

We can solve the problem of a node failure by mounting a NFS to each ...

Get The DevOps 2.1 Toolkit: Docker Swarm now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.