This post shows how to run Rocket.Chat in a docker cluster (swarm mode) starting from fresh Debian Jessie machines.

Rocket.Chat is a meteor app so other meteor apps are also run in similar way in swarm mode.

My cluster has 4 machines:

  • Manager 1:
  • Node 1:
  • Node 2:
  • Node 3:


  • Installing Docker 1.12
  • Configuring Swarm Mode
  • Setting up Rocket.Chat
  • Conclusion

Installing Docker 1.12

Install Docker engine on all machines:

export DEBIAN_FRONTEND=noninteractive ; \
apt-get update -y ;\
apt-get install -y -q apt-transport-https ;\
apt-key adv --keyserver hkp:// --recv-keys 58118E89F3A912897C070ADBF76221572C52609D ;\
echo "deb debian-jessie main" > /etc/apt/sources.list.d/docker.list ;\
apt-get update -y -q;\
apt-get upgrade -y -q;\
apt-get install -y -q docker-engine

Configuring Swarm Mode

On Manager 1:

docker swarm init --advertise-addr
docker info
docker network create --driver overlay my-net

The containers are using the my-net network to reach each others.

On Node 1,2,3, join the swarm:

docker swarm join --token SWMTKN-1-0plr12edz0xijk17oqh01rjg1jjopvpkwo5iztv608wcg408m1-cvm2x5ve0yhlesy2bso6s2rwl

On Manager 1, check the node list:

docker node ls

The 4 nodes appear on the list.

Setting up Rocket.Chat

2 services are created: mongo (MongoDB) and chat (Rocket.Chat).

docker service create --replicas 1 --name mongo --network my-net mongo --smallfiles
docker service create --replicas 1 --name chat --network my-net --publish 3000:3000 rocketchat/

Now Rocket.Chat is available at any public address of the cluster due to routing and load balancing features of swarm mode: - - - -

Scale Rocket.Chat:

docker service scale chat=3


Docker Swarm has improved a lot with version 1.12. The first thing is how fast it is to setup the cluster and then it is highly available, scalable and has rolling updating. I’m still leaning towards Kubernetes because of its superior, more stable concepts and more fine-grained specifications.