Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Serf on Docker

This is a docker image and a couple of helper bash function, to work with serf.

This document describe the process:

  • create the docker image
  • start a cluster of connected serf agent running in docker containers
  • stop/start nodes to check how membership gossip works

Create the image

git clone
cd docker-serf
git checkout serf-only
docker build -t sequenceiq/serf .

start a demo cluster

run 3 docker container from the image you just built. all of them is running in the background (-d docker parameter)

  • serf0 the first one doesn't joins to a cluster as he is the first
  • serf<1..n> nodes connecting to the cluster

serf-start-cluster function defaults to starting 3 nodes. if you want more just add a parameter serf-start-cluster 5

# load helper bash functions serf-xxx
. serf-functions

# start a cluster with 3 nodes

# check the running nodes
docker ps

start a test node and attach

it starts a new container name serf99, but not in the brackound, like the previous ones. you will be attached to the container, which:

  • joins the cluster
  • starts a /bin/bash ready to use

# once attached to the test instance prompt changes to [bash-4.1#]
serf members

you will see now all memebers including the test instance itself serf99

serf99.mycorp.kom  alive  
serf1.mycorp.kom  alive  
serf0.mycorp.kom  alive  
serf2.mycorp.kom  alive

Start/stop a node

Stop one of the nodes:

docker stop -t 0 serf1

now if you run again the serf members in serf99 you will notice serf1 node marked as failed. note: it might take a couple of seconds, until the cluster gossips around the failure of node99.

serf99.mycorp.kom  alive
serf1.mycorp.kom  failed  
serf0.mycorp.kom  alive
serf2.mycorp.kom  alive

if you resart the node serf1:

docker start serf1

It will apear again as live. Check it on serf99:

serf members

serf99.mycorp.kom  alive  
serf1.mycorp.kom  alive  
serf0.mycorp.kom  alive  
serf2.mycorp.kom  alive


Serf on Docker containers






No packages published

Contributors 4