Here are some sample answers to the questions presented in this chapter:
- The correct answer is as follows:
$ docker swarm init [--advertise-addr <IP address>]
The --advertise-addr is optional and is only needed if you the host have more than one IP address.
- On the worker node that you want to remove, execute the following command:
$ docker swarm leave
On one of the master nodes, execute the command $ docker node rm -f<node ID>, where <node ID> is the ID of the worker node to remove.
- The correct answer is as follows:
$ docker network create \
--driver overlay \
--attachable \
front-tier
- The correct answer is as follows:
$ docker service create --name web \
--network front-tier \
--replicas 5 \
-p 3000:80 \
nginx:alpine
- The correct answer is as follows:
$ docker service update --replicas 3 web