阿里自研容器技术Pouch安装与部署 - Go语言中文社区

阿里自研容器技术Pouch安装与部署


阿里巴巴正式开源其自研容器技术Pouch

日前,在2017中国开源年会上,阿里巴巴自研容器技术 Pouch 宣布开源。在双十一买买买的狂潮之后,阿里选择第一时间将 Pouch 技术开源,无疑,这又一次吸引无数开发者的目光。而担任阿里 Pouch 技术的开源负责人,《Docker源码分析》的作者孙宏亮大神前几个月从Daocloud跳到了阿里,为阿里将自研容器技术 Pouch 开源提供了契机。


Pouch前世今身

image.png

提到Pouch,不得不提到阿里的T4,T4 是阿里在2011年的时候基于 Linux Container(LXC) 开发的容器技术基础设施。相比 Docker 的模式和理念,T4 其实更适合阿里内部的运维现状。T4 是从阿里内部的资源管理和日常运维中土生土长出来的产品,在诞生的第一天就针对内部基础设施、运维工具甚至是运维习惯做了很多特别的设计。因此,在阿里内部进行容器管理时,融合 T4 的 Pouch 技术比起 Docker 来说会稍胜一筹。

在去年2016年的双11狂欢节晚会上,每秒交易量几十万峰值就是通过这个产物进行实现的(详细可以看看阿里的《双11背后的故事》有一章节专门讲到了T4)将很多核心的业务都放在了T4容器里面运行。Pouch 的前身就是T4,它的实现是剔除了T4核心业务的开元版本。阿里内部之所以可以做到业务100%容器化,主要是借助阿里巴巴集团系统软件部对业务系统的了解,与容器技术 Pouch 的不断优化。

这句话转载自知乎周毅
Pouch是对Docker和T4都做了一些修改整合后,将两者融合为了一个产品,相当于既让T4具备了Docker的镜像能力,又让Docker具备了T4对内部运维体系的友好性,并且能够运行在内部早期的AliOS5u和2.6内核上。这个产品在内部称为AliDocker,在去年8月份推出了第一个雏形版本。

演进
Pouch技术

Pouch 在2017年双11的接近一年时间内,投入了巨大精力提升 Pouch 的稳定性,同时对稳定性的指标要求也是不断在提高。直到今年双11,1682亿交易额背后拥有百万级容器规模的支撑集群,也极大的验证了稳定性的战役取得了不小的成绩。

Pouch与T4的三生三世

可以看看 阿里中间件团队博客
集团AliDocker化双11总结

可以看看孙洪亮本人对Pouch的理解

阿里自研容器技术Pouch前景如何?*

更有兴趣的大佬

可以看看简书中“云栖大会”发布的文章:阿里巴巴正式开源其自研容器技术Pouch

Pouch 的代码也已经在 GitHub 公开,大家可以点击
https://github.com/alibaba/pouch
查看详情。

谈谈个人的理解把

Pouch是阿里T4容器的开源实现,很多核心的业务层已经剔除掉了,相当于基于LXC技术重新实现了容器引擎。好比国人自主研发了一款类似于Docker的原生产品。具体Pouch能走多远我们不知道,但是我更希望也能创造出一个Pouch生态圈,拥抱云原生.

个人理解,不喜勿喷,多多赎罪.(>-<)


Installation

先说一下Pouch的安装部署把,Pouch 的安装还真是让我折腾了许久,fork&clone下来后,发现其官方文档还是挺缺失的,毕竟也是新产品,还是原谅下啦~
接下来进入正题:

https://github.com/alibaba/pouch/blob/master/INSTALLATION.md

Ubuntu&&Centos系都支持,这里笔者采用Centos7.2最小化安装系统来进行部署(其实就是ecs >-<)

Pre

首先,你的host需要满足

*   Linux Kernel 3.10+
*   Go 1.9.0+
*   containerd: 1.0.0-beta.3
*   runc: 1.0.0-rc4
*   runv: 1.0.0 (option)

Prerequisites Installation预安装

安装必要的软件包

yum update -y
yum install automake autoconf  git  pkg-config make gcc golang qemu aclocal libseccomp-devel -y

In order to enable seccomp support you will need to install libseccomp on your platform.

e.g. libseccomp-devel for CentOS, or libseccomp-dev for Ubuntu

Go环境1.9.x+

$ wget https://redirector.gvt1.com/edgedl/go/go1.9.2.linux-amd64.tar.gz
$ tar -C /usr/local -xzf go1.9.2.linux-amd64.tar.gz 
$ vim /etc/profile
#Add GOROOT Lines
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin

#Add GOPATH Lines
export GOPATH=/root/go
export PATH=$PATH:$GOPATH/bin

$ source /etc/profile
$ go version
go
  • containerd: an industry-standard container runtime;
  • runc: a CLI tool for spawning and running containers according to the OCI specification;
  • runv: a hypervisor-based runtime for OCI.

安装containerd

# install containerd
$ wget https://github.com/containerd/containerd/releases/download/v1.0.0-beta.3/containerd-1.0.0-beta.3.linux-amd64.tar.gz
$ tar -xzvf containerd-1.0.0-beta.3.linux-amd64.tar.gz -C /usr/local
$
containered

安装runc

# 官方模式,由于众所周知的原因未安装成功
$ wget https://github.com/opencontainers/runc/releases/download/v1.0.0-rc4/runc.amd64 -P /usr/local/bin 
$ chmod +x /usr/local/bin/runc.amd64
$ mv /usr/local/bin/runc.amd64 /usr/local/bin/runc
# 我的做法!我的做法!我的做法!


mkdir -p $GOPATH/src/github.com/opencontainers/
cd $GOPATH/src/github.com/opencontainers/
git clone https://github.com/opencontainers/runc
cd  runc/
make
make install 
runc
runc安装

安装runV

mkdir -p $GOPATH/src/github.com/hyperhq
cd  $GOPATH/src/github.com/hyperhq
git clone https://github.com/hyperhq/runv/
cd runv/
 ./autogen.sh
./configure --without-xen
make
make install

在运行runV之前,你需要安装一些依赖

#Install qemu
yum install -y qemu qemu-kvm

#Install hyperstart
cd $GOPATH/src/github.com 
git clone https://github.com/hyperhq/hyperstart.git
cd hyperstart/
 ./autogen.sh 
./configure
make 
mkdir /var/lib/hyper
cp build/hyper-initrd.img /var/lib/hyper/
cp build/kernel_patch/0001-HACK-9P-always-use-cached-inode-to-fill-in-v9fs_vfs_.patch /var/lib/hyper/
runV

安装Pouch

mkdir -p $GOPATH/src/github.com/alibaba/ 
cd $GOPATH/src/github.com/alibaba/ 
git clone https://github.com/alibaba/pouch.git
cd pouch/
make install
Pouch安装完成

重要的事情说三遍!重要的事情说三遍!重要的事情说三遍!记得运行Pouchd

pouchd
相当于new一个类似于docker daemon

然后你就可以享受pouch带来的基本命令了


Pouch安装完毕
[root@VM_58_62_centos github.com]# pouch
An efficient container engine

Usage:
  pouch [command]

Available Commands:
  create      Create a new container with specified image
  exec        Exec a process in a running container
  help        Help about any command
  images      List all images
  ps          List all containers
  pull        Pull an image from registry
  start       Start a created or stopped container
  stop        Stop a running container
  version     Print versions about Pouch CLI and Pouchd
  volume      Manage pouch volumes

Flags:
  -h, --help               help for pouch
  -H, --host string        Specify connecting address of Pouch CLI (default "unix:///var/run/pouchd.sock")
      --tlscacert string   Specify CA file of TLS
      --tlscert string     Specify cert file of TLS
      --tlskey string      Specify key file of TLS
      --tlsverify          Use TLS and verify remote

Use "pouch [command] --help" for more information about a command.
[root@VM_58_62_centos github.com]# cd 
[root@VM_58_62_centos ~]# pouch
An efficient container engine

Usage:
  pouch [command]

Available Commands:
  create      Create a new container with specified image
  exec        Exec a process in a running container
  help        Help about any command
  images      List all images
  ps          List all containers
  pull        Pull an image from registry
  start       Start a created or stopped container
  stop        Stop a running container
  version     Print versions about Pouch CLI and Pouchd
  volume      Manage pouch volumes

Flags:
  -h, --help               help for pouch
  -H, --host string        Specify connecting address of Pouch CLI (default "unix:///var/run/pouchd.sock")
      --tlscacert string   Specify CA file of TLS
      --tlscert string     Specify cert file of TLS
      --tlskey string      Specify key file of TLS
      --tlsverify          Use TLS and verify remote

Use "pouch [command] --help" for more information about a command.
[root@VM_58_62_centos ~]# 

注意一下

现在pouch暂时只是支持docker.io Registry的镜像,Pouch其他Registry镜像会报错

[root@VM_58_62_centos ~]# pouch pull awesomedocker/centos7-sshd
awesomedocker/centos7-sshd:latest: resolving      |--------------------------------------| 
elapsed: 0.0 s                     total:   0.0 B (0.0 B/s)                                         
failed to pull image: failed to do request: Head https://awesomedocker/v2/centos7-sshd/manifests/latest: dial tcp: lookup awesomedocker on 10.225.30.223:53: no such host
[root@VM_58_62_centos ~]# pouch pull docker.io/library/hello-world:latest 
docker.io/library/hello-world:latest:                                             resolved       |++++++++++++++++++++++++++++++++++++++| 
index-sha256:be0cd392e45be79ffeffa6b05338b98ebb16c87b255f48e297ec7f98e123905c:    exists         |++++++++++++++++++++++++++++++++++++++| 
manifest-sha256:8072a54ebb3bc136150e2f2860f00a7bf45f13eeb917cca2430fcd0054c8e51b: exists         |++++++++++++++++++++++++++++++++++++++| 
layer-sha256:ca4f61b1923c10e9eb81228bd46bee1dfba02b9c7dac1844527a734752688ede:    exists         |++++++++++++++++++++++++++++++++++++++| 
config-sha256:f2a91732366c0332ccd7afd2a5c4ff2b9af81f549370f7a19acd460f87686bc7:   exists         |++++++++++++++++++++++++++++++++++++++| 
elapsed: 2.0 s                                                                    total:   0.0 B (0.0 B/s)                                         
[root@VM_58_62_centos ~]# 
提供给你们的小test,可以试试
pouch create docker.io/library/nginx:alpine
pouch start [containerID]
pouch exec -it [containerID] /bin/sh

提交了两个issue 哈哈哈~


能得到allencloud的回复,真是荣幸(容我在旁边激动一下>-<)


犯了个基础上的错误,大神们很耐心的回答呢~


借用孙宏亮大神的一句话"
后续会有补充,不到之处,还望各位提出斧正。"

-< >-< >-< >-< >-< >-< >-< >-<
在这里 预祝阿里孙宏亮团队的Pouch越做越好~

版权声明:本文来源简书,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://www.jianshu.com/p/3e4ca915b287
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-01-12 13:51:15
  • 阅读 ( 1125 )
  • 分类:职场

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢