Docker Swarm services and stacks
So far, we have looked at the following commands:
$ docker swarm <command> $ docker node <command>
These two commands allow us to bootstrap and manage our Docker Swarm cluster from a collection of existing Docker hosts. The next two commands we are going to look at are as follows:
$ docker service <command> $ docker stack <command>
The service
and stack
commands allow us to execute tasks that, in turn, launch, scale, and manage containers within our Swarm cluster.
Services
The service
command is a way of launching containers that take advantage of the Swarm cluster. Let's look at launching a really basic single-container service on our Swarm cluster.
TIP
Don't forget that the docker
commands here need to be executed from your current Swarm manager. If you are following, that should be node2
.
To do this, run the following command:
$ docker service create \ Â Â Â Â --name...