This is my docker-stackk.yaml file.
# cat docker-stack.yml
version: "3.4"
services:
redis:
image: redis:alpine
ports:
- "6379"
networks:
- frontend
deploy:
replicas: 1
update_config:
parallelism: 2
delay: 10s
restart_policy:
condition: on-failure
networks:
frontend:
volumes:
db-data:
I did not specified any constraint.
# docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS ENGINE VERSION
snbsjfcg8eu6w88oyinsaa2q0 * infinity Ready Active Reachable 20.10.8
bi2iblsfma9dno4thvcpetc29 rockpi Ready Active Leader 20.10.8
d5nk1bgdpmo05u1pdlbtxppem rockpix Ready Active 19.03.8
if you see above rockpix is worker node. and infinity is manager.
but when I started the stack the container started on manager node instead of worker node.
# docker stack ps redis-stack
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
zvd9dyx10ro9 redis-stack_redis.1 redis:alpine infinity Running Running 2 minutes ago