Right now I'm using Docker Compose to host 15-20 services for my home lab. All of these are running on a single machine which is physically in my house. I have no interest in scalability (i.e. replicating my services to different nodes), but I was told that Docker Swarm would be a good step in the right direction over Compose. It also means that I can use Portainer to control my stacks (since I use compose v3 format, they do not support it).
Right now I run a cron job on my system that does the following for each stack running on my system (i.e. each
docker-compose downall the services
- Back up the volumes (physically zip them and copy them to a NAS)
docker-compose pullto get the latest images
docker-compose up -dto restart everything.
Note that this process restarts containers even for services that had no new image update. This is important because some containers are designed to internally update their software at entrypoint.
If I use Docker Swarm, even for a single machine, does it allow this type of automation to be performed more easily? I see that there is a swarm update command, but it looks very confusing and I'm not sure if it provides the functionality I've described above (excluding the backup part).
Can I use Docker Swarm to automate updating images of services and recreating containers to keep them updated? If so, how can I do that? Examples would be very helpful!