Book Image

Beginning DevOps with Docker

By : Joseph Muli
5 (1)
Book Image

Beginning DevOps with Docker

5 (1)
By: Joseph Muli

Overview of this book

Making sure that your application runs across different systems as intended is quickly becoming a standard development requirement. With Docker, you can ensure that what you build will behave the way you expect it to, regardless of where it's deployed. By guiding you through Docker from start to finish (from installation, to the Docker Registry, all the way through to working with Docker Swarms), we’ll equip you with the skills you need to migrate your workflow to Docker with complete confidence.
Table of Contents (7 chapters)

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...