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

..18-Dec-2020-

api/H18-Dec-2020-47,44044,520

archive/H18-Dec-2020-2,0311,399

cio/H18-Dec-2020-655482

containers/H18-Dec-2020-11329

content/H18-Dec-2020-862556

defaults/H18-Dec-2020-13732

diff/H18-Dec-2020-609414

errdefs/H18-Dec-2020-242133

events/H18-Dec-2020-334224

filters/H18-Dec-2020-1,039705

identifiers/H18-Dec-2020-7432

images/H18-Dec-2020-1,7871,228

labels/H18-Dec-2020-3817

leases/H18-Dec-2020-365212

log/H18-Dec-2020-9143

mount/H18-Dec-2020-1,064574

namespaces/H18-Dec-2020-323142

oci/H18-Dec-2020-1,7451,367

pkg/dialer/H18-Dec-2020-180106

platforms/H18-Dec-2020-839466

plugin/H18-Dec-2020-475283

reference/H18-Dec-2020-16371

remotes/H18-Dec-2020-3,6282,253

rootfs/H18-Dec-2020-532345

runtime/H18-Dec-2020-11,17310,519

snapshots/H18-Dec-2020-586291

sys/H18-Dec-2020-1,073528

version/H18-Dec-2020-306

.appveyor.ymlH A D18-Dec-20202.6 KiB6455

.gitignoreH A D18-Dec-202060 76

.golangci.ymlH A D18-Dec-2020292 2422

.mailmapH A D18-Dec-20202.4 KiB5049

.travis.ymlH A D18-Dec-20205.3 KiB132117

.zuul.yamlH A D18-Dec-2020326 1513

ADOPTERS.mdH A D18-Dec-20204.4 KiB4124

BUILDING.mdH A D18-Dec-202010.6 KiB269189

LICENSEH A D18-Dec-202010.5 KiB192160

MakefileH A D18-Dec-202010.5 KiB309223

Makefile.darwinH A D18-Dec-2020739 234

Makefile.freebsdH A D18-Dec-2020740 234

Makefile.linuxH A D18-Dec-2020900 309

Makefile.windowsH A D18-Dec-2020757 266

NOTICEH A D18-Dec-2020519 1710

PLUGINS.mdH A D18-Dec-20209.8 KiB268227

Protobuild.tomlH A D18-Dec-20202.7 KiB7261

README.mdH A D18-Dec-202010.2 KiB255172

RELEASES.mdH A D18-Dec-202014.1 KiB312230

ROADMAP.mdH A D18-Dec-20201.3 KiB2917

RUNC.mdH A D18-Dec-20201.3 KiB2615

SCOPE.mdH A D18-Dec-20204.5 KiB5839

client.goH A D18-Dec-202022 KiB765576

client_opts.goH A D18-Dec-20205.6 KiB214141

code-of-conduct.mdH A D18-Dec-2020155 42

container.goH A D18-Dec-202011.6 KiB440351

container_checkpoint_opts.goH A D18-Dec-20205 KiB157119

container_opts.goH A D18-Dec-20208.2 KiB272196

container_opts_unix.goH A D18-Dec-20203.4 KiB11786

container_restore_opts.goH A D18-Dec-20204.9 KiB150111

containerd.serviceH A D18-Dec-2020641 2420

containerstore.goH A D18-Dec-20205.4 KiB197153

diff.goH A D18-Dec-20203.1 KiB11787

events.goH A D18-Dec-20202.7 KiB12389

export.goH A D18-Dec-20201,005 329

grpc.goH A D18-Dec-20201.6 KiB5329

image.goH A D18-Dec-202010.1 KiB386277

image_store.goH A D18-Dec-20203.9 KiB155115

import.goH A D18-Dec-20204.9 KiB206151

install.goH A D18-Dec-20202.9 KiB11994

install_opts.goH A D18-Dec-20201.3 KiB4818

lease.goH A D18-Dec-20201.2 KiB4723

namespaces.goH A D18-Dec-20202.8 KiB12281

process.goH A D18-Dec-20206.2 KiB243178

pull.goH A D18-Dec-20206.5 KiB239173

services.goH A D18-Dec-20203.4 KiB11374

signals.goH A D18-Dec-20202.2 KiB8452

signals_unix.goH A D18-Dec-20201.3 KiB4823

signals_windows.goH A D18-Dec-20201.9 KiB6440

snapshotter_default_linux.goH A D18-Dec-2020847 254

snapshotter_default_unix.goH A D18-Dec-2020878 274

snapshotter_default_windows.goH A D18-Dec-2020845 254

task.goH A D18-Dec-202017.9 KiB677533

task_opts.goH A D18-Dec-20206.2 KiB212155

task_opts_unix.goH A D18-Dec-20202.9 KiB10678

unpacker.goH A D18-Dec-20207.1 KiB280228

vendor.confH A D18-Dec-20204.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