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

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.

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.

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.

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

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.

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.

Image Selection Modal

Application Configuration

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.

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.

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

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

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

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.

时间: 2024-08-27 21:57:46

Setting up a Production Docker Environment with Alibaba Container Service的相关文章

Docker的images和container啥关系

问题描述 我看过一些文章,还是有一些疑问DockerimagesADockerimageisaread-onlytemplate.Forexample,animagecouldcontainanUbuntuoperatingsystemwithApacheandyourwebapplicationinstalled.ImagesareusedtocreateDockercontainers.Dockerprovidesasimplewaytobuildnewimagesorupdateexist

docker~从Dockerfile到Container的过程(终于算是OK了)

上一文章,主要介绍Dockerfile里各参数的含义,以及在项目文件里这些内容的含义,因为大叔认为官方和网上其它文章说的有些模棱两可,不太好让大家理解,所有我又从新写了一个大白话的文章,希望可以给大家一些帮助.<DotNetCore跨平台~Dockerfile的解释> 本文章主要对一个windows下的dotnet new api生成的项目进行迁移,将它存储为一个镜像,然后运行这个镜像,生成一个容器,容器对外开放5000端口,大家就可以通过5000来访问它了,说起来很容易,做起来有些坑! Do

《循序渐进学Docker》——第一部分 Part 1 基础篇 第1章 全面认识Docker 1.1 Docker是什么

第一部分 Part 1 基 础 篇 第1章 全面认识Docker 第2章 初步体验Docker 第3章 Ubuntu下使用Docker 第4章 Docker的基础知识 第1章 全面认识Docker 欢迎来到Docker的世界. Docker,Golang社区杀手级的应用,是Github上最活跃的项目之一,也是开源社区最受欢迎的项目. Docker,号称要成为所有云应用的基石,并把互联网升级到下一代. 开发.测试.运维人员看到Docker,都激动地说:"太好了,这正是我所需要的!" Do

5分钟学习基于Go,go-microservice-template,Minke的微服务

本文讲的是5分钟学习基于Go,go-microservice-template,Minke的微服务,[编者的话]本篇文章介绍了Go语言下构建微服务的例子,作者利用一个helloword讲解了如何使用他的微服务框架,该框架不仅包含了构建服务,还包括路由.请求验证.日志记录.测试.动态配置变更,最后将提供了将服务整合到Docker容器并持续集成.本文干货满满,虽然需要一些对Go语言的基础,但是这构建微服务的思路是通用的. 介绍 几周前我去参加一个零售环境下的技术会议,直到午饭时间都没人提及'Dock

Docker@Alibaba——超大规模Docker化的实战经验

Docker之于Alibaba,是一场超大规模Docker化的实战经验.阿里研究员将从四个方面Docker化前的阿里,Docker化的目标,Docker化碰到的问题以及未来阿里对实现Docker的展望传授经验. Docker化前的阿里,虚拟化层面ECS,T4作为基于LXC的"VM",标准化层面有内部自定义的基线,部署模式层面有多种多样,甚至不同语言不同部署系统.谋求改变面临的问题如标准化不好推进,需要更强制的DevOPS模式,多种部署模式导致的重复建设要一一解决. Docker化的目标

Docker入门者手册

Docker - Beginner's tutorial Docker is a relatively new and rapidly growing project that allows to create very light "virtual machines". The quotation marks here are important, what Docker allows you to create are not really virtual machines, th

Changing the Way of Continuous Delivery with Docker (Part 2)

Introduction Docker is a service that has reformed the way of conducting continuous delivery. Docker allows you to package an application with all of its dependencies into a standardized unit for software development and guarantees that the software

Docker for SME&#039;s: Watch Out for these Five Traps

During the 18th TechDay of The Computing Conference, Qi Jun, CTO of Router Software Company Limited from Nanjing, made a presentation titled How Can Medium-sized and Small Enterprises Make Clever Use of Container Technology, sharing the company's exp

国外一些有价值的docker相关的文章

国外一些有价值的docker相关的文章   docker 每周都有周报进行更新,有一个网站列出了从开始2015年1月30日的一些有价值的链接:   关于Weave: 在Azure上一个CoreOS集群上安装Weave Docker虚拟网络https://github.com/chanezon/azure-linux/blob/master/coreos/weave/README.md Crate with Docker & Weavehttps://crate.io/blog/crate-wit