• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/ISSUE_TEMPLATE/H03-Dec-2019-5541

.zuul/playbooks/containerd-build/H03-Dec-2019-2118

api/H03-May-2022-48,29045,298

archive/H03-Dec-2019-4,0093,077

cio/H03-Dec-2019-961687

cmd/H03-Dec-2019-10,4947,831

containers/H03-Dec-2019-11329

content/H03-Dec-2019-3,5432,515

contrib/H03-Dec-2019-1,6781,231

defaults/H03-Dec-2019-13732

design/H03-May-2022-445322

diff/H03-Dec-2019-1,6391,143

docs/H03-May-2022-1,3961,067

errdefs/H03-Dec-2019-345211

events/H03-Dec-2019-669505

filters/H03-Dec-2019-1,6711,275

gc/H03-Dec-2019-886586

identifiers/H03-Dec-2019-14783

images/H03-Dec-2019-1,7871,228

labels/H03-Dec-2019-9248

leases/H03-Dec-2019-365212

log/H03-Dec-2019-21999

metadata/H03-Dec-2019-8,4636,726

metrics/H03-Dec-2019-1,7641,485

mount/H03-Dec-2019-1,8391,246

namespaces/H03-Dec-2019-524268

oci/H03-Dec-2019-2,7872,195

pkg/H03-Dec-2019-3,3912,255

platforms/H03-Dec-2019-1,282829

plugin/H03-Dec-2019-475283

protobuf/plugin/H03-Dec-2019-328230

reference/H03-Dec-2019-364244

releases/H03-Dec-2019-694500

remotes/H03-Dec-2019-4,5902,997

reports/H03-Dec-2019-1,329942

rootfs/H03-Dec-2019-532345

runtime/H03-Dec-2019-25,18322,327

script/H03-Dec-2019-333141

services/H03-Dec-2019-5,5444,024

snapshots/H03-Dec-2019-10,0057,081

sys/H03-Dec-2019-1,551871

vendor/H03-Dec-2019-762,164611,467

version/H03-Dec-2019-306

.appveyor.ymlH A D03-Dec-20192.6 KiB6455

.gitignoreH A D03-Dec-201960 76

.golangci.ymlH A D03-Dec-2019292 2422

.mailmapH A D03-Dec-20192.4 KiB5049

.travis.ymlH A D03-Dec-20195.3 KiB132117

.zuul.yamlH A D03-Dec-2019326 1513

ADOPTERS.mdH A D03-Dec-20194.4 KiB4124

BUILDING.mdH A D03-Dec-201910.6 KiB269189

LICENSEH A D03-Dec-201910.5 KiB192160

MakefileH A D03-Dec-201910.5 KiB309223

Makefile.darwinH A D03-Dec-2019739 234

Makefile.freebsdH A D03-Dec-2019740 234

Makefile.linuxH A D03-Dec-2019900 309

Makefile.windowsH A D03-Dec-2019757 266

NOTICEH A D03-Dec-2019519 1710

PLUGINS.mdH A D03-Dec-20199.8 KiB268227

Protobuild.tomlH A D03-Dec-20192.7 KiB7261

README.mdH A D03-Dec-201910.2 KiB255172

RELEASES.mdH A D03-Dec-201914.1 KiB312230

ROADMAP.mdH A D03-Dec-20191.3 KiB2917

RUNC.mdH A D03-Dec-20191.3 KiB2615

SCOPE.mdH A D03-Dec-20194.5 KiB5839

benchmark_test.goH A D03-Dec-20192.8 KiB12595

client.goH A D03-Dec-201922 KiB765576

client_opts.goH A D03-Dec-20195.6 KiB214141

client_test.goH A D03-Dec-201910.3 KiB437360

client_ttrpc_test.goH A D03-Dec-20192 KiB7545

client_unix_test.goH A D03-Dec-20191.8 KiB7144

client_windows_test.goH A D03-Dec-2019960 3313

code-of-conduct.mdH A D03-Dec-2019155 42

container.goH A D03-Dec-201911.6 KiB440351

container_checkpoint_opts.goH A D03-Dec-20195 KiB157119

container_checkpoint_test.goH A D03-Dec-201911 KiB535437

container_linux_test.goH A D03-Dec-201937.7 KiB1,8071,485

container_opts.goH A D03-Dec-20198.2 KiB272196

container_opts_unix.goH A D03-Dec-20193.4 KiB11786

container_restore_opts.goH A D03-Dec-20194.9 KiB150111

container_test.goH A D03-Dec-201935 KiB1,7321,439

containerd.serviceH A D03-Dec-2019641 2420

containerstore.goH A D03-Dec-20195.4 KiB197153

content_test.goH A D03-Dec-20192.2 KiB8962

daemon_config_linux_test.goH A D03-Dec-20196.4 KiB264207

daemon_test.goH A D03-Dec-20192.7 KiB134102

diff.goH A D03-Dec-20193.1 KiB11787

events.goH A D03-Dec-20192.7 KiB12389

export.goH A D03-Dec-20191,005 329

export_test.goH A D03-Dec-20191.9 KiB8559

grpc.goH A D03-Dec-20191.6 KiB5329

helpers_unix_test.goH A D03-Dec-20191.4 KiB5830

helpers_windows_test.goH A D03-Dec-20191.6 KiB5830

image.goH A D03-Dec-201910.1 KiB386277

image_store.goH A D03-Dec-20193.9 KiB155115

image_test.goH A D03-Dec-20195.6 KiB234166

import.goH A D03-Dec-20194.9 KiB206151

import_test.goH A D03-Dec-201910 KiB375312

install.goH A D03-Dec-20192.9 KiB11994

install_opts.goH A D03-Dec-20191.3 KiB4818

lease.goH A D03-Dec-20191.2 KiB4723

lease_test.goH A D03-Dec-20193.4 KiB14293

namespaces.goH A D03-Dec-20192.8 KiB12281

process.goH A D03-Dec-20196.2 KiB243178

pull.goH A D03-Dec-20196.5 KiB239173

services.goH A D03-Dec-20193.4 KiB11374

signals.goH A D03-Dec-20192.2 KiB8452

signals_test.goH A D03-Dec-20191.2 KiB4829

signals_unix.goH A D03-Dec-20191.3 KiB4823

signals_windows.goH A D03-Dec-20191.9 KiB6440

snapshot_test.goH A D03-Dec-20191.3 KiB5127

snapshotter_default_linux.goH A D03-Dec-2019847 254

snapshotter_default_unix.goH A D03-Dec-2019878 274

snapshotter_default_windows.goH A D03-Dec-2019845 254

task.goH A D03-Dec-201917.9 KiB677533

task_opts.goH A D03-Dec-20196.2 KiB212155

task_opts_unix.goH A D03-Dec-20192.9 KiB10678

task_opts_unix_test.goH A D03-Dec-20191.5 KiB6433

unpacker.goH A D03-Dec-20197.1 KiB280228

vendor.confH A D03-Dec-20194.4 KiB9285

README.md

1![containerd banner](https://raw.githubusercontent.com/cncf/artwork/master/projects/containerd/horizontal/color/containerd-horizontal-color.png)
2
3[![GoDoc](https://godoc.org/github.com/containerd/containerd?status.svg)](https://godoc.org/github.com/containerd/containerd)
4[![Build Status](https://travis-ci.org/containerd/containerd.svg?branch=master)](https://travis-ci.org/containerd/containerd)
5[![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/containerd/containerd?branch=master&svg=true)](https://ci.appveyor.com/project/mlaventure/containerd-3g73f?branch=master)
6[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fcontainerd%2Fcontainerd?ref=badge_shield)
7[![Go Report Card](https://goreportcard.com/badge/github.com/containerd/containerd)](https://goreportcard.com/report/github.com/containerd/containerd)
8[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1271/badge)](https://bestpractices.coreinfrastructure.org/projects/1271)
9
10containerd is an industry-standard container runtime with an emphasis on simplicity, robustness and portability. It is available as a daemon for Linux and Windows, which can manage the complete container lifecycle of its host system: image transfer and storage, container execution and supervision, low-level storage and network attachments, etc.
11
12containerd is designed to be embedded into a larger system, rather than being used directly by developers or end-users.
13
14![architecture](design/architecture.png)
15
16## Getting Started
17
18See our documentation on [containerd.io](https://containerd.io):
19* [for ops and admins](docs/ops.md)
20* [namespaces](docs/namespaces.md)
21* [client options](docs/client-opts.md)
22
23See how to build containerd from source at [BUILDING](BUILDING.md).
24
25If you are interested in trying out containerd see our example at [Getting Started](docs/getting-started.md).
26
27
28## Runtime Requirements
29
30Runtime requirements for containerd are very minimal. Most interactions with
31the Linux and Windows container feature sets are handled via [runc](https://github.com/opencontainers/runc) and/or
32OS-specific libraries (e.g. [hcsshim](https://github.com/Microsoft/hcsshim) for Microsoft). The current required version of `runc` is always listed in [RUNC.md](/RUNC.md).
33
34There are specific features
35used by containerd core code and snapshotters that will require a minimum kernel
36version on Linux. With the understood caveat of distro kernel versioning, a
37reasonable starting point for Linux is a minimum 4.x kernel version.
38
39The overlay filesystem snapshotter, used by default, uses features that were
40finalized in the 4.x kernel series. If you choose to use btrfs, there may
41be more flexibility in kernel version (minimum recommended is 3.18), but will
42require the btrfs kernel module and btrfs tools to be installed on your Linux
43distribution.
44
45To use Linux checkpoint and restore features, you will need `criu` installed on
46your system. See more details in [Checkpoint and Restore](#checkpoint-and-restore).
47
48Build requirements for developers are listed in [BUILDING](BUILDING.md).
49
50## Features
51
52### Client
53
54containerd offers a full client package to help you integrate containerd into your platform.
55
56```go
57
58import (
59  "github.com/containerd/containerd"
60  "github.com/containerd/containerd/cio"
61)
62
63
64func main() {
65	client, err := containerd.New("/run/containerd/containerd.sock")
66	defer client.Close()
67}
68
69```
70
71### Namespaces
72
73Namespaces allow multiple consumers to use the same containerd without conflicting with each other.  It has the benefit of sharing content but still having separation with containers and images.
74
75To set a namespace for requests to the API:
76
77```go
78context = context.Background()
79// create a context for docker
80docker = namespaces.WithNamespace(context, "docker")
81
82containerd, err := client.NewContainer(docker, "id")
83```
84
85To set a default namespace on the client:
86
87```go
88client, err := containerd.New(address, containerd.WithDefaultNamespace("docker"))
89```
90
91### Distribution
92
93```go
94// pull an image
95image, err := client.Pull(context, "docker.io/library/redis:latest")
96
97// push an image
98err := client.Push(context, "docker.io/library/redis:latest", image.Target())
99```
100
101### Containers
102
103In containerd, a container is a metadata object.  Resources such as an OCI runtime specification, image, root filesystem, and other metadata can be attached to a container.
104
105```go
106redis, err := client.NewContainer(context, "redis-master")
107defer redis.Delete(context)
108```
109
110### OCI Runtime Specification
111
112containerd fully supports the OCI runtime specification for running containers.  We have built in functions to help you generate runtime specifications based on images as well as custom parameters.
113
114You can specify options when creating a container about how to modify the specification.
115
116```go
117redis, err := client.NewContainer(context, "redis-master", containerd.WithNewSpec(oci.WithImageConfig(image)))
118```
119
120### Root Filesystems
121
122containerd allows you to use overlay or snapshot filesystems with your containers.  It comes with builtin support for overlayfs and btrfs.
123
124```go
125// pull an image and unpack it into the configured snapshotter
126image, err := client.Pull(context, "docker.io/library/redis:latest", containerd.WithPullUnpack)
127
128// allocate a new RW root filesystem for a container based on the image
129redis, err := client.NewContainer(context, "redis-master",
130	containerd.WithNewSnapshot("redis-rootfs", image),
131	containerd.WithNewSpec(oci.WithImageConfig(image)),
132)
133
134// use a readonly filesystem with multiple containers
135for i := 0; i < 10; i++ {
136	id := fmt.Sprintf("id-%s", i)
137	container, err := client.NewContainer(ctx, id,
138		containerd.WithNewSnapshotView(id, image),
139		containerd.WithNewSpec(oci.WithImageConfig(image)),
140	)
141}
142```
143
144### Tasks
145
146Taking a container object and turning it into a runnable process on a system is done by creating a new `Task` from the container.  A task represents the runnable object within containerd.
147
148```go
149// create a new task
150task, err := redis.NewTask(context, cio.Stdio)
151defer task.Delete(context)
152
153// the task is now running and has a pid that can be use to setup networking
154// or other runtime settings outside of containerd
155pid := task.Pid()
156
157// start the redis-server process inside the container
158err := task.Start(context)
159
160// wait for the task to exit and get the exit status
161status, err := task.Wait(context)
162```
163
164### Checkpoint and Restore
165
166If you have [criu](https://criu.org/Main_Page) installed on your machine you can checkpoint and restore containers and their tasks.  This allow you to clone and/or live migrate containers to other machines.
167
168```go
169// checkpoint the task then push it to a registry
170checkpoint, err := task.Checkpoint(context)
171
172err := client.Push(context, "myregistry/checkpoints/redis:master", checkpoint)
173
174// on a new machine pull the checkpoint and restore the redis container
175checkpoint, err := client.Pull(context, "myregistry/checkpoints/redis:master")
176
177redis, err = client.NewContainer(context, "redis-master", containerd.WithNewSnapshot("redis-rootfs", checkpoint))
178defer container.Delete(context)
179
180task, err = redis.NewTask(context, cio.Stdio, containerd.WithTaskCheckpoint(checkpoint))
181defer task.Delete(context)
182
183err := task.Start(context)
184```
185
186### Snapshot Plugins
187
188In addition to the built-in Snapshot plugins in containerd, additional external
189plugins can be configured using GRPC. An external plugin is made available using
190the configured name and appears as a plugin alongside the built-in ones.
191
192To add an external snapshot plugin, add the plugin to containerd's config file
193(by default at `/etc/containerd/config.toml`). The string following
194`proxy_plugin.` will be used as the name of the snapshotter and the address
195should refer to a socket with a GRPC listener serving containerd's Snapshot
196GRPC API. Remember to restart containerd for any configuration changes to take
197effect.
198
199```
200[proxy_plugins]
201  [proxy_plugins.customsnapshot]
202    type = "snapshot"
203    address =  "/var/run/mysnapshotter.sock"
204```
205
206See [PLUGINS.md](PLUGINS.md) for how to create plugins
207
208### Releases and API Stability
209
210Please see [RELEASES.md](RELEASES.md) for details on versioning and stability
211of containerd components.
212
213### Communication
214
215For async communication and long running discussions please use issues and pull requests on the github repo.
216This will be the best place to discuss design and implementation.
217
218For sync communication we have a community slack with a #containerd channel that everyone is welcome to join and chat about development.
219
220**Slack:** Catch us in the #containerd and #containerd-dev channels on dockercommunity.slack.com.
221[Click here for an invite to docker community slack.](https://dockr.ly/slack)
222
223### Security audit
224
225A third party security audit was performed by Cure53 in 4Q2018; the [full report](docs/SECURITY_AUDIT.pdf) is available in our docs/ directory.
226
227### Reporting security issues
228
229__If you are reporting a security issue, please reach out discreetly at security@containerd.io__.
230
231## Licenses
232
233The containerd codebase is released under the [Apache 2.0 license](LICENSE.code).
234The README.md file, and files in the "docs" folder are licensed under the
235Creative Commons Attribution 4.0 International License. You may obtain a
236copy of the license, titled CC-BY-4.0, at http://creativecommons.org/licenses/by/4.0/.
237
238## Project details
239
240**containerd** is the primary open source project within the broader containerd GitHub repository.
241However, all projects within the repo have common maintainership, governance, and contributing
242guidelines which are stored in a `project` repository commonly for all containerd projects.
243
244Please find all these core project documents, including the:
245 * [Project governance](https://github.com/containerd/project/blob/master/GOVERNANCE.md),
246 * [Maintainers](https://github.com/containerd/project/blob/master/MAINTAINERS),
247 * and [Contributing guidelines](https://github.com/containerd/project/blob/master/CONTRIBUTING.md)
248
249information in our [`containerd/project`](https://github.com/containerd/project) repository.
250
251## Adoption
252
253Interested to see who is using containerd? Are you using containerd in a project?
254Please add yourself via pull request to our [ADOPTERS.md](./ADOPTERS.md) file.
255