Replicating actual containers in a service

There are times when I need to update and restart one of my nodes, and before I do so, I put it in drain availability, so my services/containers on it are replicated on another server. One thing I realized is it just creates a new container linked to the service with the same image, it doesn’t actually replicate anything from the container, not even the file system. Is there any way that I could get it to actually replicate the container, like taking a snapshot and launching a new container from that, or at least start it from the original container when the node is active again?

Right, this is the way Docker normally works. Container file systems are not especially permanent and you should plan for them to go away. As another prominent example, if you needed a container running a newer version of its software, the usual way to do it is to get or build a new image and then delete and recreate any containers running the old image.

This means that any persistent data your containers might have needs to be stored outside the container. In Swarm I think this has to mean named Docker volumes. (In plain single-host Docker, IMHO, host directories are easier to manage; in Kubernetes, you’d use a persistent volume claim.)