Setting up a Production Docker Environment with Alibaba Container Service

简介: Due to the portability, flexibility, and maintainability of containers, it's no surprise that Docker is a favorite amongst DevOps practitioners.

0213_Continuous_delivery_with_Docker_change_the_way_of_delivery_with_technology_Part_2

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

01

Alibaba Cloud Console

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.

02

Alibaba Container Service Overview

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.

03

New Container Cluster Checkout

At a high level, the information on this page should be pretty self-explanatory. As with all Alibaba Cloud products, you will have to select a region and zone for your instance to live on. One thing that stands out from the typical setup is that there is only one Network Type, which is the VPC (Virtual Private Cloud) network. This network allows you to create a private network within the Alibaba Cloud, keeping your application infrastructure isolated from the rest of Alibaba Cloud.

Another configuration option worth pointing out is the Swarm Mode Cluster Mode option. Swarm mode is a feature of Docker 1.12 that "integrates the cluster management and container orchestration functions of the Docker engine and Swarm, and adds the service concept and LVS-based L4 load balancing (RoutingMesh)." At the time of this writing, the Swarm Mode cluster is currently in beta.

04

Cluster Configuration Confirmation

After checking out, you will be presented with a confirmation of all of the services that will be spun up with your new cluster. This is generally a few ECS instances, an EIP instance, a load balancer, and a security group. It is also important to know that if this is your first time setting up a cluster on the Container Service, you will be asked to activate the Resource Access Management service as well, which is a similar process to activating the Container Service, and is a required step.

Launching an Application on the Cluster

05

Alibaba Container Service Applications

With our shiny new cluster in hand, we can now deploy a Docker container to it, and expose it to the Internet. To do this, head on over to the Application List within the Alibaba Container Service dashboard and click on the "Create Application" button. This will bring you to a new application wizard, which will allow you to select everything from the container and cluster to individual container settings prior to launching the application.

06

New Application Basic Information

For the purposes of this demo, I've chosen to launch a simple WordPress application. If we select the "Create with Image" button while creating our application, we will be given the option to select any image that is publicly available on Docker Hub.

07

Image Selection Modal

Application Configuration

08

Application Configuration

Before we can launch our new application, we must first provide some basic configuration. If you selected one of the pre-configured images from Docker Hub, then a lot of this process is already done for you. That said, there are a few steps that must be taken to allow your application to be accessed from the Internet.

09

Network Configuration

The most important piece of your new Docker application to configure is network access. Since most web applications are generally available on port 80, we need to expose port 80 within our container to the public network, and then we also have to define a domain name for said port. For the purposes of this demonstration, I'm using a pre-generated domain name provided by Alibaba Cloud. This can be done by entering a slug within the Domain configuration (shown above), which will create a publicly accessible URL of the form

http://<slug>.<id>.<region>.alicontainer.com.

10

Deployment Configuration

Another great feature of the Alibaba Container Service is the deployment configuration, which can be set up prior to launching your new application as well. While there are a few options here, the most important is Auto Scaling, which allows you to automatically scale the resources devoted to your application up or down, depending on the current load.

Accessing the Application

11

Application Details

Once we've launched our application, all we need to do is access it. To find the URL we generated, open up the Application Details and take a look at the Access Endpoint setting. Opening it up in a new browser window or tab should take you directly to the homepage of your new application (which, in our case, is the WordPress setup wizard).

12

WordPress Setup Wizard

Taking Things Further

Launching a simple web application is a great way to get your feet wet with the Alibaba Container Service, but thanks to features like Auto Scaling and the ability to automatically launch new services directly from Docker Hub images, it is easy to see how a complex, service-oriented application could be launched with minimal effort. While the nuances of managing and securing any container service are out of the scope of this article, spinning up the infrastructure required to run any application can be done in an afternoon thanks to the ease-of-use of the Alibaba Container Service.

Bio

13

Zachary Flower (@zachflower) is a freelance writer and lead developer at Emerson Stone, a Boulder-based design and branding agency. He has an eye for simplicity and usability, and strives to build products with both the end user and business goals in mind. From building projects for the NSA to creating features for companies like Name.com and Buffer, Zach has always taken a strong stand against needlessly reinventing the wheel, often advocating for the use of well established third-party and open source services and solutions to improve the efficiency and reliability of a development project.

目录
相关文章
|
22天前
|
缓存 自然语言处理 Docker
[Docker] DevContainer高效开发(第一篇):基于remote container开发
VS Code的Dev Containers简化了Python的容器化开发,将开发环境与应用一同打包在Docker中,消除环境配置问题。这种方式使得多语言、多版本开发变得整洁高效。
29 0
|
4月前
|
网络协议 应用服务中间件 nginx
一文详解Docker容器(Container)
一文详解Docker容器(Container)
|
5月前
|
Docker 容器
docker run 报错“Container XXX is restarting, wait until the container is running“
docker run 报错“Container XXX is restarting, wait until the container is running“
220 0
|
8月前
|
负载均衡 安全 Linux
【Docker】Docker network之bridge、host、none、container以及自定义网络的详细讲解
【Docker】Docker network之bridge、host、none、container以及自定义网络的详细讲解
308 0
|
9月前
|
Shell Docker Python
docker container的操作
docker container的操作
59 0
|
10月前
|
存储 缓存 固态存储
【Docker】浅谈Docker之AUFS、BTRFS、ZFS、Container、分层的概念
【Docker】浅谈Docker之AUFS、BTRFS、ZFS、Container、分层的概念
277 0
|
Docker 容器
Docker:查看container容器的 ip 地址
Docker:查看container容器的 ip 地址
709 0
|
Ubuntu Unix Linux
Docker 镜像(image)& 容器(container)
什么是 Docker 镜像(image)? 镜像由多个层组成,每层叠加之后,从外部看来就如一个独立的对象; 镜像内部是一个精简的操作系统(OS),同时还包含应用运行所必须的文件和依赖包; 镜像可以运行一个或多个容器,同时镜像也可以停止某个容器的运行,并从中创建新的镜像;【镜像(iamge)的分类】...
488 1
Docker 镜像(image)& 容器(container)
|
网络安全 Docker 容器
docker启动出现Error response from daemon: Cannot restart container的报错
docker启动出现Error response from daemon: Cannot restart container的报错
docker启动出现Error response from daemon: Cannot restart container的报错
|
Kubernetes 安全 Linux
From Docker to Kubernetes(一)- Image And Container
From Docker to Kubernetes(一)- Image And Container
From Docker to Kubernetes(一)- Image And Container