Embedding Containerd
(for fun and profit)
Phil Estes, IBM Cloud Architecture, Office of the CTO
@estesp
1
@estesp
Why Containerd?
•“Boring,” stable core container runtime for the
ecosystem
•Useful for any higher layer container native
stack component (e.g. container orchestrator)
• Used by Kubernetes incubator CRI (containerd-cri)
• Used by Docker engine (17.12 CE and above)
•Move governance from BDFL to TSC
• Moby TSC formed and in place; governance docs
updated
2
runc
containerd
@estesp
Who Uses Containerd?
•cri-containerd
• Implements the CRI for containerd daemon
•LinuxKit
• Core container runtime for minimal, secure Linux OS assembler
• BuildKit
• Highly efficient container image builder; can use containerd directly
•Docker engine/Swarm
• containerd 1.0 takes the place of minimal containerd 0.2.x implementation
for 17.12 and above
3
@estesp
Containerd Architecture
• Discrete, decoupled
services exposed via
gRPC
• Use known good
technology
• OCI runtime/image
• gRPC
• Prometheus
• Not opinionated
towards one platform
• Apply learnings from
runtime history
4
Runtimes
Metadata
ContainersContent DiffSnapshot Tasks EventsImages
GRPC Metrics
Runtimes
Storage
OS
@estesp
Containerd API
•Guiding principles:
• Simplicity/Clarity
• Stability (gRPC/protobuf
versioned)
•Pass through model: API objects
are lightweight metadata
• doesn’t attempt to abstract
existing specs (OCI)
•GoDoc published (see resources)
5
@estesp
Containerd Client Example
An example containerd client application
https://github.com/estesp/examplectr
•Let’s code a simple client using the Go client library to:
• connect to the containerd daemon
• pull an image
• create a container
• start the container (task)
6
@estesp
Containerd Advanced Example
•Let’s add some more concepts to our containerd client example:
• User namespaces
• (Bind) Mounting from the host
• Optional custom command
7
@estesp
Thank You!
•Containerd Project: https://github.com/containerd/containerd
•Getting Started Guide:
https://github.com/containerd/containerd/blob/master/docs/getti
ng-started.md
•GoDoc: https://godoc.org/github.com/containerd/containerd
•Website: https://containerd.io
8
Resources
API Users
• CRI-Containerd: https://github.com/containerd/containerd
• Bucketbench: https://github.com/estesp/bucketbench
• Moby project engine: https://github.com/moby/moby/tree/master/libcontainerd

Embedding Containerd For Fun and Profit

  • 1.
    Embedding Containerd (for funand profit) Phil Estes, IBM Cloud Architecture, Office of the CTO @estesp 1
  • 2.
    @estesp Why Containerd? •“Boring,” stablecore container runtime for the ecosystem •Useful for any higher layer container native stack component (e.g. container orchestrator) • Used by Kubernetes incubator CRI (containerd-cri) • Used by Docker engine (17.12 CE and above) •Move governance from BDFL to TSC • Moby TSC formed and in place; governance docs updated 2 runc containerd
  • 3.
    @estesp Who Uses Containerd? •cri-containerd •Implements the CRI for containerd daemon •LinuxKit • Core container runtime for minimal, secure Linux OS assembler • BuildKit • Highly efficient container image builder; can use containerd directly •Docker engine/Swarm • containerd 1.0 takes the place of minimal containerd 0.2.x implementation for 17.12 and above 3
  • 4.
    @estesp Containerd Architecture • Discrete,decoupled services exposed via gRPC • Use known good technology • OCI runtime/image • gRPC • Prometheus • Not opinionated towards one platform • Apply learnings from runtime history 4 Runtimes Metadata ContainersContent DiffSnapshot Tasks EventsImages GRPC Metrics Runtimes Storage OS
  • 5.
    @estesp Containerd API •Guiding principles: •Simplicity/Clarity • Stability (gRPC/protobuf versioned) •Pass through model: API objects are lightweight metadata • doesn’t attempt to abstract existing specs (OCI) •GoDoc published (see resources) 5
  • 6.
    @estesp Containerd Client Example Anexample containerd client application https://github.com/estesp/examplectr •Let’s code a simple client using the Go client library to: • connect to the containerd daemon • pull an image • create a container • start the container (task) 6
  • 7.
    @estesp Containerd Advanced Example •Let’sadd some more concepts to our containerd client example: • User namespaces • (Bind) Mounting from the host • Optional custom command 7
  • 8.
    @estesp Thank You! •Containerd Project:https://github.com/containerd/containerd •Getting Started Guide: https://github.com/containerd/containerd/blob/master/docs/getti ng-started.md •GoDoc: https://godoc.org/github.com/containerd/containerd •Website: https://containerd.io 8 Resources API Users • CRI-Containerd: https://github.com/containerd/containerd • Bucketbench: https://github.com/estesp/bucketbench • Moby project engine: https://github.com/moby/moby/tree/master/libcontainerd