文档章节

高性能容器伺服器-containerd简介

openthings
 openthings
发布于 2016/12/12 08:43
字数 1078
阅读 113
收藏 3

containerd是一个高性能的容器(container)伺服系统(查看源码),部分功能与Docker很像,相当于Docker Daemon模式和更新版的DockerD。

  • containerd采用并行启动技术,可以每秒启动上百个容器实例。containerd提供命令行和REST服务接口,里面对容器真正的管理是通过containerd-shim进程来完成
  • 与Docker Engine的一锅烩模式不同的是,containerd并不管理容器的镜像,主要支持OCI(https://www.opencontainers.org/)开放容器标准的镜像,通过runc来启动。
  • OCI镜像可以通过Docker镜像转换而来(参见:https://github.com/docker/containerd/blob/master/docs/bundle.md)。

containerd与大家熟知的Docker可谓相生相克,最新发展出的关系如下图所示。

  • Docker从1.11开始,已经支持containerd和runc来运行容器。在DockerD服务启动时自动启动了containerd作为后台进程服务(可以通过ps aux | grep docker查看)。
  • 更详细的中文介绍参考:http://dockone.io/article/1327 。

 

下面是containerd的官方介绍,原文:https://containerd.tools/

About containerd

Containerd is a daemon with an API and a command line client, to manage containers on one machine. It uses runC to run containers according to the OCI specification. Containerd has advanced features such as seccomp and user namespace support as well as checkpoint and restore for cloning and live migration of containers. The code can be found on Github. Containerd is currently available as an alpha release.

Built for Performance

Starting 1000 containers concurrently runs at 126-140 containers per second.

Easy to use

Containerd provides a daemon and a command line client to manage containers.

Battle Hardened

Containerd is built on runC, the same container technology powering millions of Docker Engine installations.

Compatible with Docker

Docker images can be run with containerd.

 

Getting Started

Daemon options

$ containerd -h

NAME:
   containerd - High performance container daemon

USAGE:
   containerd [global options] command [command options] [arguments...]

VERSION:
   0.0.4

AUTHOR(S): 
   @crosbymichael <crosbymichael@gmail.com> 

COMMANDS:
   help, h  Shows a list of commands or help for one command
   
GLOBAL OPTIONS:
   --id "deathstar"                 unique containerd id to identify the instance
   --debug                      enable debug output in the logs
   --state-dir "/run/containerd"            runtime state directory
   -c, --concurrency "10"               set the concurrency level for tasks
   --metrics-interval "1m0s"                interval for flushing metrics to the store
   --listen, -l "/run/containerd/containerd.sock"   Address on which GRPC API will listen
   --oom-notify                     enable oom notifications for containers
   --help, -h                       show help
   --version, -v                    print the version
   

GRPC API

The API for containerd is with GRPC over a unix socket located at the default location of /run/containerd/containerd.sock.

At this time please refer to the proto definition for the API methods and types.
There is a Go implementation and types checked into this repository but alternate language implementations can be created using the grpc and protoc toolchain.

containerd CLI

There is a default cli named ctr based on the GRPC api. This cli will allow you to create and manage containers run with containerd.

NAME:
   ctr - High performance container daemon controller

USAGE:
   ctr [global options] command [command options] [arguments...]

VERSION:
   0.0.4

AUTHOR(S): 
   @crosbymichael <crosbymichael@gmail.com> 

COMMANDS:
   checkpoints  list all checkpoints
   containers   interact with running containers
   events   receive events from the containerd daemon
   help, h  Shows a list of commands or help for one command
   
GLOBAL OPTIONS:
   --debug                  enable debug output in the logs
   --address "/run/containerd/containerd.sock"  address of GRPC API
   --help, -h                   show help
   --version, -v                print the version
   

Listing containers

$ sudo ctr containers
ID                  PATH                STATUS              PID1
1                   /containers/redis   running             14063
19                  /containers/redis   running             14100

Starting a container

$ ctr containers start -h
NAME:
   start - start a container

USAGE:
   command start [command options] [arguments...]

OPTIONS:
   --checkpoint, -c     checkpoint to start the container from
   --attach, -a         connect to the stdio of the container

$ sudo ctr containers start redis /containers/redis

Kill a container’s process

$ ctr containers kill -h 
NAME:
   kill - send a signal to a container or it's processes

USAGE:
   command kill [command options] [arguments...]

OPTIONS:
   --pid, -p "0"        pid of the process to signal within the container
   --signal, -s "15"    signal to send to the container

Exec another process into a container

$ ctr containers exec -h 
NAME:
   exec - exec another process in an existing container

USAGE:
   command exec [command options] [arguments...]

OPTIONS:
   --id                                         container id to add the process to
   --attach, -a                                 connect to the stdio of the container
   --cwd                                        current working directory for the process
   --tty, -t                                    create a terminal for the process
   --env, -e [--env option --env option]        environment variables for the process
   --uid, -u "0"                                user id of the user for the process
   --gid, -g "0"                                group id of the user for the process
   

Stats for a container

$ ctr containers stats -h 
NAME:
   stats - get stats for running container

USAGE:
  command stats [arguments...]

List checkpoints

$ sudo ctr checkpoints redis
NAME                TCP                 UNIX SOCKETS        SHELL
test                false               false               false
test2               false               false               false

Create a new checkpoint

$ ctr checkpoints create -h
NAME:
   create - create a new checkpoint for the container

USAGE:
   command create [command options] [arguments...]

OPTIONS:
   --tcp                persist open tcp connections
   --unix-sockets       perist unix sockets
   --exit               exit the container after the checkpoint completes successfully
   --shell              checkpoint shell jobs
   

Get events

$ sudo ctr events
TYPE                ID                  PID                 STATUS
exit                redis               24761               0

Performance

Starting 1000 containers concurrently runs at 126-140 containers per second.

Overall start times:

[containerd] 2015/12/04 15:00:54   count:        1000
[containerd] 2015/12/04 14:59:54   min:          23ms
[containerd] 2015/12/04 14:59:54   max:         355ms
[containerd] 2015/12/04 14:59:54   mean:         78ms
[containerd] 2015/12/04 14:59:54   stddev:       34ms
[containerd] 2015/12/04 14:59:54   median:       73ms
[containerd] 2015/12/04 14:59:54   75%:          91ms
[containerd] 2015/12/04 14:59:54   95%:         123ms
[containerd] 2015/12/04 14:59:54   99%:         287ms
[containerd] 2015/12/04 14:59:54   99.9%:       355ms

© 著作权归作者所有

共有 人打赏支持
openthings
粉丝 266
博文 984
码字总数 527035
作品 1
东城
架构师
Docker发布 LinuxKit 和 Moby 开源项目

  【IT168 评论】在一年一度的DockerCon大会上,来自全球各地的 5000 名参与者,济济一堂,于奥斯丁会议中心,共同见证 Docker 的发展,探讨容器技术的落地。   Docker创办人暨技术长Sol...

it168网站
2017/04/20
0
0
Containerd给Kubernetes带来了更多容器运行时的可选方案

容器运行时是在某个节点上执行容器并且管理容器镜像的软件。如今,最广为人知的容器运行时是Docker,但是,生态系统内也有一些别的容器运行时,比如rkt,containerd和Ixd。Docker是目前为止在...

Docker
02/20
0
0
Kubernetes Containerd集成进入GA阶段

在之前的博客Containerd给Kubernetes带来更多的容器运行选项[1],我们介绍了Kubernetes containerd integration的内部测试版。经历了6个月的开发,正式版推出了!现在,你可以在生产环境的K...

m2l0zgssvc7r69efdtj
05/29
0
0
containerd迎1.0通用版本,系统部署超百万!

  【IT168 技术】今天,我们很高兴地宣布 containerd,一个构建容器解决方案的行业标准运行时,已经达到了1.0里程碑。如今containerd已经被部署数以百万计的系统中,成为Docker平台上最广泛...

it168网站
2017/12/06
0
0
拥有数百万全球用户的行业标准运行时方案Containerd迎来1.0通用版本

今天,我们兴奋地宣布,containerd(音为Con-Tay-Ner-D)作为行业标准容器解决方案构建运行时,已经正式迎来1.0版本。从去年12月Docker公司宣布推出这套核心运行时,到今年3月其CNCF接手此项...

m2l0zgssvc7r69efdtj
2017/12/06
0
0

没有更多内容

加载失败,请刷新页面

加载更多

《Netkiller Java 手札》· 二进制文件操作大全

本文节选自《Netkiller Java 手札》 Netkiller Java 手札 Mr. Neo Chan, 陈景峯(BG7NYT) 中国广东省深圳市望海路半岛城邦三期 518067 +86 13113668890 <netkiller@msn.com> $Id: book.xml 6......

netkiller-
29分钟前
1
0
Fiddler Debugger post请求

常用的两种: 第一种默认的 对应URL为www 的要用请求头为:Content-Type: application/x-www-form-urlencoded 请求参数为 :param1=1234¶m2=12345 注:有些接口是指定用这种的第二方式并不...

轻量级赤影
36分钟前
3
0
如何搭建母婴亲子类知识社区

近期社交领域融资动作频繁,海尔高管、海尔医疗有限公司总裁管礼庆创办的母婴知识分享社区平台Alwayslove于上月获得700万天使轮融资。 Alwayslove是一个母婴知识分享社区平台,采用UGC模式,...

ThinkSNS账号
38分钟前
1
0
Android 自定义构建类型 BuildType

最近接触到自定义构建类型 BuildType,发现这一块有些地方稍不注意的话会被绕进去浪费点时间,既然我这边已经花费时间了,如果正好你也需要接触到 BuildType,也许接下来分享的 tips 可能会帮...

猴亮屏
40分钟前
1
0
美团点评基于 Flink 的实时数仓建设实践

引言 近些年,企业对数据服务实时化服务的需求日益增多。本文整理了常见实时数据组件的性能特点和适用场景,介绍了美团如何通过 Flink 引擎构建实时数据仓库,从而提供高效、稳健的实时数据服...

美团技术团队
43分钟前
5
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部