Docker Swarm Services

# service creation
docker service create --name=myservice -p 80:80 web:v1

# service scale up
docker service update --replicas=3 -p 80:80 web:v1

# service scale down
docker service update --replicas=1 -p 80:80 web:v1

# service rolling update
docker service update -p 80:80 --image=web:v2 web

# service rolling update with delay 60s
docker service update -p 80:80 --update-delay 60s --image=web:v2 web

# service update in parallel
docker service update -p 80:80 --update-parallelism 3 --image=web:v2 web

# service update with failure handling
docker service update -p 80:80 \
          --update-failure-action pause|continue|rollback \
          --image=web:v2 web

# service update rollback
docker service update --rollback web

# service global mode (default is replicated service)
docker service create --mode=global agent

# list service
docker service ls

# list service task
docker service ps myservice

# service inspect
docker service inspect myservice --pretty

# service logs
docker service logs myservice

# delete service
docker service rm myservice
  •  
  •  
  •  
  •  

Viet Luu has written 318 articles

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Buy Me A Coffee

We are thankful for your never ending support.