LoginSignup
14
14

More than 5 years have passed since last update.

はじめてのcontainerd

Last updated at Posted at 2017-01-09

Dockerの理解を深めるためには、containerdについてもある程度知っておくべきらしいのでメモ。

containerdとは

Docker社が開発しているcontainerのruntime。

にある通り、オープンなコミュニティに寄贈する予定。
実行中のコンテナの管理・監視であったり、コンテナイメージの管理(レジストリへのpush, pullなど)が主な役割。
コンテナ実行レイヤのランタイムは、runCを利用しているが、OCI準拠だったら何でも使えるようになる予定。

Dockerとcontainerd

Dockerは、コンテナを利用するために必要な機能を全て持ったプラットフォーム。
containerdは、プラットフォームとしてのDockerを実現するためのコンポーネントの一つ。
リンク先の図にあるように、コンテナランタイムとしての役割を果たす。

containerdとrunc

同じコンテナランタイムという位置付けのrunCとの役割分担はリンク先の図の通り。

Getting started

https://github.com/docker/containerd/blob/v0.2.x/README.md
READMEの通りに実行。コマンドだけ列挙しておく。

  • install

https://github.com/docker/containerd/releases からバイナリインストール。

$ ctr --help
NAME:
   ctr - High performance container daemon cli

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

VERSION:
   0.2.3

COMMANDS:
   checkpoints  list all checkpoints
   containers   interact with running containers
   events   receive events from the containerd daemon
   state    get a raw dump of the containerd state
   version  return the daemon version
   help, h  Shows a list of commands or help for one command
.
..
  • OCI bundle作成

https://github.com/docker/containerd/blob/v0.2.x/docs/bundle.md 参照。

$ mkdir -p redis/rootfs
$ docker pull redis
$ docker create --name tempredis redis
$ docker export tempredis | tar -C redis/rootfs -xf -
$ docker rm tempredis
$ vi redis/config.json // config file作成
省略。
$ sudo mv redis /containers/
  • 実行
// containerdの実行
$ sudo containerd
// container実行
$ sudo ctr containers start redis /containers/redis
$ sudo ctr containers list
ID                  PATH                STATUS              PROCESSES
redis               /containers/redis   running             init
14
14
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
14