Before we go any further, I should mention that there are two very different versions of Docker Swarm. There was a standalone version of Docker Swarm; this was supported up until Docker 1.12 and is no longer being actively developed; however, you may find some old documentation mentions it. Installation of the standalone Docker Swarm is not recommended as Docker ended support for version 1.11.x in the first quarter of 2017.
Docker version 1.12 introduced Docker Swarm mode. This introduced all of the functionality that was available in the standalone Docker Swarm into the core Docker engine, along with a significant number of additional features. As we are covering Docker 18.06 and higher in this book, we will be using Docker Swarm mode, which, for the remainder of the chapter, we will refer to as Docker Swarm.
As you are already running a version of Docker...