How to setup a cluster of nodes using docker swarm

0

I need to setup a clutser of nodes using docker swarm. When I say a node, it should have a db, few apps/services and they need to commuicate with each other. I can create a single instance of this using docker-compose.

But, I need multiple instances of the same setup. So, would docker swarm help? Also, can I achieve this with a single mac machine (host where docker engine running)?

Compse compose Swarm are used for multi container deployments.
While Compose does deployments on a single host, Swarm can deploy container accros multiple Hosts. Are you planing multi container accross multi host deployments? Go swarm! If the target environment is a single host -> stay with Compose.

Both allow two ways for what you ask for:

  1. a service with n identical instances (see scale and replication in the documentation)
  2. instances with (slighly) different configuration require sperate service declation each.
1 Like