博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
高性能容器伺服器-containerd简介
阅读量:5948 次
发布时间:2019-06-19

本文共 6568 字,大约阅读时间需要 21 分钟。

hot3.png

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

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

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

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

 

下面是containerd的官方介绍,原文:

About containerd

Containerd is a daemon with an API and a command line client, to manage containers on one machine. It uses to run containers according to the . 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 . Containerd is currently available as an .

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 -hNAME:   containerd - High performance container daemonUSAGE:   containerd [global options] command [command options] [arguments...]VERSION:   0.0.4AUTHOR(S):    @crosbymichael 
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 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 controllerUSAGE:   ctr [global options] command [command options] [arguments...]VERSION:   0.0.4AUTHOR(S):    @crosbymichael 
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 containersID                  PATH                STATUS              PID11                   /containers/redis   running             1406319                  /containers/redis   running             14100

Starting a container

$ ctr containers start -hNAME:   start - start a containerUSAGE:   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 processesUSAGE:   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 containerUSAGE:   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 containerUSAGE:  command stats [arguments...]

List checkpoints

$ sudo ctr checkpoints redisNAME                TCP                 UNIX SOCKETS        SHELLtest                false               false               falsetest2               false               false               false

Create a new checkpoint

$ ctr checkpoints create -hNAME:   create - create a new checkpoint for the containerUSAGE:   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 eventsTYPE                ID                  PID                 STATUSexit                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

转载于:https://my.oschina.net/u/2306127/blog/804251

你可能感兴趣的文章
python常用的包
查看>>
[译] 学习如何构建自动化、跨浏览器的 JavaScript 单元测试
查看>>
根治JavaScript中的this-ECMAScript规范解读
查看>>
协议与代理之间的阐述
查看>>
Kubernetes 1.2.0 发布,Docker集群管理驶入快车道
查看>>
在CentOS下,利用FFMPEG对视频进行转码
查看>>
SublimeText3系列(3)- HTML-CSS-JS Prettify美化代码&Markdown Preview写作
查看>>
理解 Redux
查看>>
填一填用了半个月 ionic 遇到的坑
查看>>
[译] 用 Haskell 写简单的 Monadic Parser
查看>>
bling_hash——Node.js 字符串哈希的包
查看>>
谷歌 .dev 顶级域名正式开放
查看>>
Android Q 将获得大量的隐私保护功能
查看>>
Android Volley库源码简析(Image Request部分)
查看>>
Firefox 密码管理器 Lockbox 推出 Android 版
查看>>
视频点播-资源用量
查看>>
好程序员分享大势所趋 HTML5成Web开发者最关心的技术 ...
查看>>
北汽集团荣辉:抓不住自动驾驶 就抓不住车企的命脉 | 自动驾驶这十年 ...
查看>>
豆瓣评分8.8,这本程序员案头必备宝典,10年沉淀,新版再现 ...
查看>>
运行 Spring Boot 应用的 3 种方式!
查看>>