The Commands

This lesson contains all the relevant Docker swarm commands with brief reminders of what each one does.

The summary of commands for Docker Swarm

  • docker swarm init creates a new swarm. The node you run the command on becomes the first manager and the Docker Engine on that node switches into swarm mode.
  • docker swarm join-token reveals the commands and tokens you need to join workers and managers to the swarm. You add manager to the command to get the manager join token and worker to get the worker token. Be sure to keep your join tokens secure!
  • docker node ls lists managers and workers, including which manager is the leader.

Get hands-on with 1300+ tech skills courses.