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.

目录
相关文章
|
6月前
|
负载均衡 应用服务中间件 Docker
Docker Service 创建
Docker Service 创建
|
1月前
|
Java Docker 索引
Springboot的Container Images,docker加springboot
本文介绍了如何使用Spring Boot的层索引文件和Docker优化Spring Boot应用程序的容器化过程,包括解压缩可执行jar和创建分层Docker映像的方法。
33 9
Springboot的Container Images,docker加springboot
|
15天前
|
Kubernetes Docker 容器
【赵渝强老师】Docker的Container网络模式
Docker容器在网络环境中彼此隔离,但可通过配置不同网络模式实现容器间通信。其中,container模式使容器共享同一网络命名空间,通过localhost或127.0.0.1互相访问,提高传输效率。本文介绍了container模式的特点及具体示例。
|
2月前
|
Unix Shell Linux
5-15|Docker报错OCI runtime exec failed: exec failed: unable to start container process: exec: “/bin/ba
5-15|Docker报错OCI runtime exec failed: exec failed: unable to start container process: exec: “/bin/ba
|
3月前
|
Docker 容器
【Azure 应用服务】App Service for Container 无法拉取Docker Hub中的镜像替代方案
【Azure 应用服务】App Service for Container 无法拉取Docker Hub中的镜像替代方案
|
3月前
|
Kubernetes Linux Docker
【Azure 应用服务】使用Docker Compose创建App Service遇见"Linux Version is too long. It cannot be more than 4000 characters"错误
【Azure 应用服务】使用Docker Compose创建App Service遇见"Linux Version is too long. It cannot be more than 4000 characters"错误
|
3月前
|
开发框架 .NET Linux
【Azure 应用服务】 部署到App Service for Linux 服务的Docker 镜像,如何配置监听端口呢?
【Azure 应用服务】 部署到App Service for Linux 服务的Docker 镜像,如何配置监听端口呢?
|
3月前
|
存储 Linux Docker
【Azure 应用服务】应用服务中发布Docker Container,如何添加卷(如Azure File Share)以便永久存储文件
【Azure 应用服务】应用服务中发布Docker Container,如何添加卷(如Azure File Share)以便永久存储文件
|
4月前
|
应用服务中间件 nginx Docker
docker service 与 docker stack
docker service 与 docker stack
88 0
|
4月前
|
存储 Docker 容器
docker查看日志:docker service logs 与 docker container logs
docker查看日志:docker service logs 与 docker container logs
360 0
下一篇
无影云桌面