Managing Services and Applications in a Swarm

Now that our cluster is ready, it's time to schedule some services on our cluster. As mentioned earlier, the role of the manager node is to accept Docker commands and apply them against the cluster. Therefore, we will create the services on the manager node.

Note

At this point, there really isn't much one can do on worker nodes as they are fully under the control of the manager.

Creating a Service

This command is used to create a service:

docker service create --replicas <count> -p <host_port>:<container_port> --name <service_name> <image_name>

We run this on the manager as earlier alluded to. We are going to be using the WordPress example we built in the previous lesson. Since we already have this image ...

Get Beginning DevOps with Docker now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.