December 2016
Intermediate to advanced
280 pages
5h 11m
English
Now that we have a Swarm cluster, it's time to start using it. We'll show that the spread strategy algorithm will decide to place containers to the less loaded hosts. In this example, it's really easy, as we start with four empty nodes. So, we're connected to Swarm and Swarm will put containers on hosts. We start one nginx container, mapping its port tcp/80 to the host (machine) port tcp/80.
$ docker run -d -p 80:80 nginx 2c049db55f9b093d19d575704c28ff57c4a7a1fb1937bd1c20a40cb538d7b75c
In this example, we see that the Swarm scheduler decided to place this container onto node1:

Since we have to bind a port tcp/80 to any host, ...
Read now
Unlock full access