Home / Docker

Orchestration in the Docker

Rating: 5.0Blog-star
Views: 2920
by Vinod M
Last modified: February 24th 2021

We need to orchestrate the Docker, and especially when using it in production environments. The Docker community released some tools which can be used for this purpose. Let us discuss some of these tools.

The Docker Swarm

This tool is used for the purpose of hosting and scheduling a cluster of Docker containers. You will learn about how to create a Docker Swarm on your machine and VirtualBox.
Each of the nodes used in the Docker Swarm should be in a position to access the Docker Hub for downloading and running images in your container. To create a Docker Swarm on your machine, follow the steps given below:

Learn how to use Docker, from beginner basics to advanced techniques, with online video tutorials taught by industry experts. Enroll for Free Docker Training Demo!

1. List all the machines available in your system. Use the following command:

                                           Machines available command

2. Create a VirtualBox machine and give it the name “local.” Use the command given below:

                                VirtualBox machine command

3. The machine which has been created should then be loaded into the shell. Use the following command:

                                     Shell command

4. You should then use the Docker Swarm image so as to generate a discovery token. The following command can be used for this purpose:

                                 Token command

If the latest image of “swarm: latest” is not found in your local system, it will be pulled to your system. The command will run verbosely, and you will observe the following output:

                 swarm:latest output

5. The token should then be saved in a safe place.

Frequently Asked Docker Interview Questions & Answers

Launching the Swarm Manager

This is the one responsible for orchestrating and scheduling containers in the entire system. The process of hosting the containers is done by the Swarm agents. They are a kind of regular Docker daemon which you can communicate with via the Docker remote API. Let us try to create two Swarm managers:

1. Under your VirtualBox, create a Swarm manager. This is shown below:

Swarm manager tab

2. Open the VirtualBox Manager, which should have the “local” machine and the “swarm-master” machine which we have just created. These are shown below:

The Docker Swarm

3. Create the swarm node:

Create the swarm node

4. Create another agent, and give it the name “swarm-agent-1”. This is shown below:

swarm agent command

The two agents should now be available in your VirtualBox.

Directing the Swarm

What we need to do is to establish a connection to the swarm, show the information related to it, and then start the image related to the swarm. Follow the steps given below:

1. Begin by running the following command:

Directing the Swarm

The Docker environment will be pointed to the machine which is running the swarm master.

2. Use the “docker” command so as to get information about your new swarm

                                                  Docker command

Note that at this moment, the master is running both the swarm agent container and the swarm manager. However, this is not a good technique in a production environment since the agent can develop problems

Explore Docker Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!


List Of MindMajix Docker Courses:

 Kubernetes Administration
 Docker Kubernetes
 OpenShift Administration


About Author

NameVinod M
Author Bio

Vinod M is a Big data expert writer at Mindmajix and contributes in-depth articles on various Big Data Technologies. He also has experience in writing for Docker, Hadoop, Microservices, Commvault, and few BI tools. You can be in touch with him via LinkedIn and Twitter.