×
Community Blog Container Orchestration: Docker Swarm Model for Devops

Container Orchestration: Docker Swarm Model for Devops

In this blog, you will learn some best practices of docker swarm, such as mode configuration, docker environment setting, docker management and monitoring and etc.

Docker Swarm is a native clustering tool for Docker containers that can be used to manage a cluster of Docker nodes as a single virtual system. Docker Swarm allows you to add or subtract container iterations as computing demands change. Docker Swarm consists of two main components Manager node and Worker node. Manager node used for handling cluster management tasks such as, maintaining cluster state, scheduling services and serving swarm mode HTTP API endpoints. Worker node is a instance of Docker engine that can be used to execute container. The Swarm manager allows you to create a primary manager instance and multiple replica instances in case the primary instance fails. You can deploy manager and worker nodes at runtime in Docker engine's Swarm mode.

In this tutorial, we will go through the step by step instruction on configuring three node Docker Swarm cluster on CentOS 7.

Requirements

  1. Three Alibaba cloud instances with CentOS 7 installed. Out of which once server will act as a Manager node and two servers will act as Worker node.
  2. A static IP address is configured on all the instances. Here, we will use IP address 192.168.0.102 for Manager node, 192.168.0.103 for Worker node1 and 192.168.0.104 for Worker node2.

Launch Alibaba Cloud ECS Instance

First, Login to your Alibaba Cloud ECS Console. Create a new ECS instance, choosing CentOS 7 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.

Once you are logged into your CentOS 7 instance, run the following command to update your base system with the latest available packages.

yum update -y

Getting Started

Before starting, you will need to configure /etc/hosts file on each node, so each node can communicate with each other by hostname.

You can update the /etc/hosts file on each node as shown below:

nano /etc/hosts

192.168.0.102  managernode
192.168.0.103  workernode1
192.168.0.104  workernode2

Save and close the file when you are finished.

Next, you will need to configure hostname on each node as per /etc/hosts file.

You can refer to How to Install and Configure Docker Swarm Mode on CentOS 7 to get the following steps.

Related Blogs

Setting up a Production Docker Environment with Alibaba Container

Docker is a favorite container amongst DevOps practitioners. Nearly every tech company - and a not-insignificant number of non-tech companies - use Docker in some fashion or another.

Due to the portability, flexibility, and maintainability of containers, it's no surprise that Docker is a favorite amongst DevOps practitioners. Nearly every tech company—and a not-insignificant number of non-tech companies—use Docker in some fashion or another.

There are many different ways to run Docker. But if you’re looking for an easy solution for getting up and running with Docker containers without having to do much setup and management yourself, Alibaba Container Service is a good solution. This article shows how to get started using Alibaba Container Service.

Getting Started with Alibaba Container Service

Thanks to the growing ubiquity of Docker, I took a look at how to spin up a production-ready Docker environment with Alibaba Container Service. To get started with the Alibaba Container Service, the first thing we must do is create a new Docker Cluster. To do this, head on over to the Alibaba Container Service dashboard by clicking on the Container Service button within your Alibaba Cloud Console. I should note here that, if this is your first time accessing the Alibaba Container Service, you will be asked to activate it. All this step does is ask you to agree to the terms and conditions of the service, and does not incur any charges to your account.

Once you've activated the service, you will be taken to the Container Service Overview. This page will present you with the option to create a cluster using a button helpfully labeled "Create Cluster." Clicking on it will take you to a page that allows you to select all of the information required to spin up a new container cluster.

How to Manage and Monitor Docker Containers Using Dry

In this tutorial, you will learn how to manage and monitor Docker containers, images, and networks running on ECS instances using Dry.

Dry is a simple terminal application to manage and monitor Docker containers, which gives detailed information about Nodes, Service, Stacks and Swarm constructs. You can easily start and stop Docker containers, remove Docker images, and monitor real-time container processes by using Dry.

In this tutorial, we will learn how to install Dry on an Alibaba Cloud Elastic Compute Service (ECS) instance that is installed with Ubuntu 16.04. We will also learn how to use Dry to manage and monitor Docker containers, images, and networks.

Requirements

  1. A newly created ECS instance installed with Ubuntu 16.04.
  2. The static IP address 192.168.43.192 is set up for your instance.
  3. A root password is set up for your instance.

Procedure

To manage and monitor Docker containers with Dry, follow these steps:

Launch Alibaba Cloud ECS Instance

First, log on to your Alibaba Cloud ECS Console. Then, create a new ECS instance with Ubuntu 16.04 as the operating system and with at least 2GB RAM. Last, connect to your ECS instance and log on as the root user.

After you are logged on to your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.

apt-get update -y

Practical Exercises for Docker Compose: Part 1

This set of tutorials focuses on giving you practical experience on using Docker Compose when working with containers on Alibaba Cloud Elastic Compute Service (ECS). This tutorial focuses on you using the shell a lot: interactively exciting.

After you completed this set of 5 tutorials you can spend time reading the official Docker Compose documentation: https://docs.docker.com/compose/compose-file/. Everything will make a lot more sense since you now have actual practical (simple) experience with most of the Docker Compose instructions.

Part 1 of 5 demonstrates several docker-compose configuration options that can be explored in isolation. Every separate heading section below explores just ONE docker-compose option - making the config files very short and very easy to understand.

Let's get started.

Prerequisites

You need access to a server/VPS with a recent version of Docker already installed. In this tutorial, I will be using an Alibaba Cloud Elastic Compute Service (ECS) instance with CentOS and Docker.

You don't need to purchase a large instance to follow this tutorial. Even when swarms of 6 containers are running in later tutorials you still need a server with only a total RAM of 512MB.

Although I am writing this tutorial using CentOS, you can also use Debian or Ubuntu. A large majority of this tutorial will work on any Linux distributions since it mostly uses Docker Compose commands.

You need a very basic understanding of Docker, images, containers and using docker-compose and docker ps -a. You need to have used docker-compose up around 3 times to roughly understand its concepts.

The purpose of this tutorial is to get you to docker-compose up several very simple docker compose files. Your understanding of Docker compose concepts will grow as you use it.

Related Courses

Using Swarm to Orchestrate and Manage Containers

This course aims to help IT companies who want to container their business applications, and cloud computing engineers or enthusiasts who want to learn container technology and Swarm. By learning this course, you can fully understand what a Swarm is, some key concepts of Swarm, the basic architecture of Swarm, why we need Swarm, and the basic use of Alibaba Cloud Container Service for Swarm, so as to provide reference for the evaluation, design and implementation of application containerization.

Introduction To Docker Container

This course is associated with Introduction to Docker Container. You must purchase the certification package before you are able to complete all lessons for a certificate.

Related Documentation

Support for Container Service Swarm is ending

After December 31, 2019, Alibaba Cloud will no longer provide technical support for Container Service Swarm. However, you can continue to use Container Service Kubernetes and enjoy stable and reliable enterprise-class services. We recommend that you migrate your applications in advance according to the following information:

  1. From July 1, 2019, Swarm clusters cannot be created in the Container Service console. If you have special requirements, open a ticket.
  2. From December 31, 2019, console functions and documentation that are related to Swarm clusters will be brought offline. You can manage your existing Swarm clusters by calling API actions.

For information about how to migrate applications from Swarm clusters to Kubernetes clusters, see Migration solution overview.

Use Chef to automatically deploy Docker and WebServer

Chef is an automated deployment framework. Combined with Alibaba Cloud Container Service, Chef can help you achieve customization and automation in your deployment. Log on to the Chef official website first to learn about basic terms for quick start, such as cookbook, recipe, chef workstation, chef server, and chef nodes.

Prerequisites

  1. You have created a swarm cluster that retains the EIP.
  2. Prepare a local Linux environment. This example uses Ubuntu 16.04. According to your local environment, download a ChefDK at https://downloads.chef.io/chefdk/.
  3. Log on to the Chef official website to register an account and create an organization. In this example, the created organization is called example.

Related Market Products

Using Swarm to Orchestrate and Manage Containers

Through the introduction of Docker, Swarm and Alibaba Cloud Swarm, this course enables learners to quickly get started with Container Service for Swarm.

Introduction to Docker Container

This course is aiming to provide comprehensive introduction of docker container technology and the container service on alibaba cloud as well.

Related Products

Container Service for Kubernetes (ACK)

A fully-managed service compatible with Kubernetes to help users focus on their applications rather than managing container infrastructure

Container Registry

Container Registry allows you to manage images throughout the image lifecycle. It provides secure image management, stable image build creation across global regions, and easy image permission management. This service simplifies the creation and maintenance of the image registry and supports image management in multiple regions. Combined with other cloud services such as Container Service, Container Registry provides an optimized solution for using Docker in the cloud.

0 0 0
Share on

Alibaba Clouder

2,600 posts | 750 followers

You may also like

Comments