What is the best way to remove and then re-add a node in a Docker Swarm cluster?

Specifically we want to remove a node from cluster and re-add it back in.

If the node you want to remove is still up, ssh into that node and leave the Swarm by running the following:

docker swarm leave

On the master node take note of the node id that left the swarm (docker node ls) and remove the node by running the following:

docker node rm <id of the node>

Finally you can join your new node by visiting the cluster page and clicking the "Add Node" button to obtain the node join script. Add Nodes