Skip to content

Instantly share code, notes, and snippets.



Last active Nov 29, 2017
What would you like to do?
Docker swarm for Raspberry Pi cluster


Services are incompatible with the nodes

By default, docker swarm will assume that a service will run on x86 systems and accordingly set the services target platform to amd64. In the case of our raspis, this results in an error ("no suitable node") when inspecting the service execution list. This problem can be circumvented by specifying the --no-resolve-image flag when running docker service create.

Specifying which node a service may run on

In order to specify compatibility between nodes and services two things need to be done

  1. The node needs to be specified with a label. This can be done when running docker node create by specifying the tag --label cam=true. When updating the node: docker node update --label-add cam=true.
  2. The service needs to have a constraint. A constraint may be added via docker service create --constraint '' .... When updating a node: docker service update --constraint-add ''

Error: "memory cgroup not supported on this system: unknown"

When inspecting running instances of a service we were getting this error. Solution suggested here worked: on the worker node, add cgroup_enable=memory cgroup_memory=1 to the /boot/cmdline.txt and reboot.

Set up an overlay network

sudo docker network create -d overlay --attachable pi-net

Service creation

sudo docker service create --network=pi-net --constraint='node.labels.motor==true' --no-resolve-image --name publisher kugele1337/messenger-pub
sudo docker service create --network=pi-net --constraint='' --no-resolve-image --name subscriber kugele1337/messenger-sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment