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 locally, there will be no hassle pulling it from the hub.
Our replica count is going to be three because we currently have three worker nodes; confirm your node number by running docker node ls
.
Note
We do not create a...