If I immediately terminate the process that called docker stack deploy will the docker swarm continue?

My use case is this:

  1. In my CI job I ssh into my swarm cluster node.
  2. I copy the new stack.yml file and issue
  3. docker stack deploy -c stack.yml stack
  4. Since this immediately returns, my CI job disconnects from ssh.

My question is whether this can lead to some unforeseen side-effects? Is my deploy being terminated midway? Or will docker swarm be smart enough to keep going on its own.


  • You could test it: run the cmd through a ssh session and ctrl-D once you issue it Aug 16, 2018 at 17:47
  • I'm getting weird behaviour, regardless of what I do. Some of my services (out of 3 replicas) get updated, while others don't... Aug 17, 2018 at 5:20
  • Sounds like it's not safe. Try adding a custom CI step consisting in checking the stack deployment, based on docker stack stack services executions... Aug 17, 2018 at 9:13

1 Answer 1


It is safe. As soon as docker returns it is safe to logout/leave the shell.

The issue was that Docker 18.06.0-ce broke docker stack deploy. Reverting to 18.03.1 (specifically 18.03.1~ce-0~ubuntu) made it work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.