Restart one service in docker swarm stack

Scale to 0 and back up:

docker service scale myservice=0
docker service scale myservice=10

Doing docker stack deploy again for me is the way to go to update services. As Francois' Answer, and also in my own experience, doing so updates only services that need to be updated.

But sometimes, it seems easier when testing stuff to only restart a single service. In my case, I had to clear the volume and update the service to start it like it was fresh. I'm not sure if there is downside to the method I will describe. I tested it on my development stack and it worked great for me.

Get the service id you want to tear down then use docker service update --force <id> to force the update of the service which effectively re-deploy it

$ docker stack services <stack_name>
ID                  NAME              ...
3xrdy2c7pfm3        stack-name_api    ...

$ docker service update --force 3xrdy2c7pfm3

The --force flag will force the service to update causing it to restart.