Check out the official documentation on how nodes work at https://docs.docker.com/engine/swarm/how-swarm-mode-works/nodes/.