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.
In order to specify compatibility between nodes and services two things need to be done
- The node needs to be specified with a label. This can be done when running
docker node createby specifying the tag--label cam=true. When updating the node:docker node update --label-add cam=true. - The service needs to have a constraint. A constraint may be added via
docker service create --constraint 'node.labels.cam==true' .... When updating a node:docker service update --constraint-add 'node.labels.cam==true'
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.
sudo docker network create -d overlay --attachable pi-net
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='node.labels.cam==true' --no-resolve-image --name subscriber kugele1337/messenger-sub