Docker Community Forums

Share and learn in the Docker community.

Docker compose vs swarm?

Before I ask my question, I wanted to provide some background on my setup and what I’m trying to accomplish.

For my home server, I am hosting about 20 containers using Docker Compose. I have 1 YML for my reverse proxy, with an external network, which I connect the other YML files to. I have about 3 others that construct back end web services that are connected to the reverse proxy. I just run a few services for home use, nothing that needs any kind of scalability.

I host my own machine at home to save money. I like being in control of my hardware and not having to pay monthly to use something.

My setup right now consists of a cron job which, once a week, recursively runs docker-compose pull and docker-compose up -d on each of my YML files. It also compresses the volume mounts on the host into a 7z file and backs them up to my NAS. This is my really bare bones attempt at automation. I just want to make sure my container images are updated automatically at some interval, and that the volumes are backed up.

I’m looking to take this one step further, if I can. I want to have some sort of way to visualize my containers, their status, and get notified if any containers are stopped or not working/healthy. Portainer looks like the right choice here, but they don’t support Docker Compose v3 (I’m using v3 for my compose files).

Portainer has introduced me to Docker Swarm, but I’m not sure if it’s the right tool for me. I’m not a business running scalable services. I’m not sure if moving to swarm benefits me in any way. As I understand it, it does restrict some of the v3 compose features. I’m not sure which ones, but I’d need a way to audit that.

So my main question is: Should I move to swarm, and does it benefit me? Is Swarm replacing normal Docker Compose? I’d like some advice on how I should host everything, because up to this point it’s just been mostly self research. I am not sure what the “Right” way of doing things is. I prefer to stay up to date on the newest tech, if it makes sense for my use cases, and newest best practices.

Thanks in advance for any education!

i ended up using swarm to create a monitoring prometheus solution. I can tell you that swarm orchestrates the use of containers. Keeping up to date with newest tech will have some drawbacks. What are you trying to achieve?
you have 20 containers already I think is time for you to move up the ladder and properly orchestrate them.
That will bring the battle Swarm vs Kubernetes.
The fancy talk nowadays is Kubernetes.

Specially for the automation you attempted with the containers’ data volumes zipped to NAS.

Lots of folks just use Rancher (either 1.6 Cattle or 2.0 Kubernetes). Its Free, Open Source, fairly easy to setup, has a fantastic GUI, even a CLI. With Rancher 1.6, its as easy as just deploy 1 Rancher Master and 1 Rancher agents on each VM host that you have. With Rancher 2.0, its Kubernetes orchestration, but the path is just as easy, just different. With your simple home setup, you could probably be up and running with Rancher 2.0 in a few hours. I’d advise to just make the leap and go with Rancher 2.0

If you are trying to move from compose to swarm there are some keys that are not allowed in stack yml files, for example build is not allowed you have to pass a image name, container name not allowed, link not allowed instead you should use custom networks. A andvantaje with swarm over compose have the ability to use docker secrets or docker configs that make you pass secured passwords to the conatiners. I think is better if you can star with swarm because you already have de basic of services (alias docker compose)