Finally fixed it !
It was a networking issue, as pointed out in this issue.
The working stack:
version: '3.5'
services:
crate:
image: crate:latest
ports:
- "4200:4200"
environment:
SLOT: "{{.Task.Slot}}"
volumes:
- crate-data:/data
hostname: "crate-{{.Task.Slot}}"
command: >
crate
-Ccluster.name=swarm
-Cnode.name=crate-$${SLOT}
-Cnetwork.publish_host=_eth0_
-Cdiscovery.type='zen'
-Cdiscovery.seed_hosts=tasks.crate
-Ccluster.initial_master_nodes=crate-1
deploy:
replicas: 3
volumes:
crate-data:
name: 'crate-data-{{.Task.Slot}}'