They are very similar, but if you are upgrading from docker compose to docker stack, you may need to modify your existing docker compose yaml file. From what I noticed, here are the obvious pain points
- No build. If you have build and args, you will need to do that outside of the yaml file. Docker stack expects to see image.
- No container_name. If you have other services (e.g. nginx) that depend on container_name, you will need to use some workarounds.
Since there are too many sample docker compose yaml files out there, chances are that you will need to modify them if you want to stick with docker stack. I spent too much time playing with nginx, caddy, and traefik, all had some unexpected weird issues with docker stack. The moment I switched back to docker compose, all issues are gone. I will stick with docker compose for now.