When comparing Docker Compose vs Docker Swarm, the Slant community recommends Docker Swarm for most people. In the question“What are the best Docker orchestration tools?” Docker Swarm is ranked 2nd while Docker Compose is ranked 3rd. The most important reason people chose Docker Swarm is:
This also means that containers can be launched with a simple `docker run` command and Swarm will take care of the rest, such as selecting the appropriate host on which to run the container.
Ranked in these QuestionsQuestion Ranking
Pro Easy setup
All that's needed to setup a multi-container application with Compose is a single file configuration file. Finally the application can be spun up with only a single command.
Pro Great for local development
Docker-compose isn't really meant (yet) for distributed deployment, but using it to deploy a website locally for testing is awesome. You could use it, with care (like handling faults), on a single server as well.
Pro Easy setup
This also means that containers can be launched with a simple
docker run command and Swarm will take care of the rest, such as selecting the appropriate host on which to run the container.
Pro Communicates with other Docker tools easily
Since Docker Swarm is a native Docker tool, it exposes the Docker API, making it possible t integrate it and communicate with other Docker tools (CLI, Compose, Krane, etc.).
Docker Swarm is much more lightweight than alternatives: Kubernetes and Mesosphere. Kubernetes, for instance, is very complex - it downloads and installs half of the web, where Docker Swarm has much, much smaller footprint.
Pro Compatible with Docker Compose
This gives you a well-rounded workflow.
Pro Open source
Docker Swarm is open source and provides great guides/documentation for those who want to contribute.
Con Not ready for production yet
While Compose is very good for staging servers, CI and development environments, it's still not ready for production and it's not recommended to be used in production yet.
Con Bounded by the limitations of the Docker API
If the Docker API doesn't support something, then you are pretty much out of luck when it comes to Docker Swarm, because it won't be supported by Swarm either.
Con Not fault tolerant
If a node dies in your cluster, the containers on that node won't be restarted