Go to file
Derek McGowan f35f21dd0b
Add CRI release functionality to makefile
Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-09-23 14:10:27 -07:00
.github update to golang 1.15.2 2020-09-11 09:21:25 +02:00
.zuul/playbooks/containerd-build update to golang 1.15.2 2020-09-11 09:21:25 +02:00
api vendor protobuf & grpc 2020-02-26 10:57:05 +09:00
archive Replace errors.Cause() with errors.Is() 2020-05-08 14:36:45 +02:00
cio cio: should not open fifo for stderr if terminal 2020-07-02 11:49:31 +08:00
cmd Merge pull request #4529 from gongguan/creator 2020-09-21 13:33:51 -04:00
containers fix-grammar-mistake 2019-08-28 16:10:08 +08:00
content Add support for NetBSD 2020-09-22 20:03:50 +02:00
contrib Merge pull request #4050 from thaJeztah/bump_golang_1.14 2020-09-14 09:42:13 -07:00
defaults Remove windows v1 runtime 2019-07-23 18:54:37 +00:00
design Remove outdated plugin design doc 2018-07-25 23:28:09 -07:00
diff Annotate bare ErrNotImplemented returns 2020-07-16 20:16:11 +10:00
docs update docs/rootless.md 2020-08-08 04:08:35 +09:00
errdefs Replace errors.Cause() with errors.Is() 2020-05-08 14:36:45 +02:00
events [events/exchange_test] Fix deadlock in TestExchangeFilters 2020-07-10 10:27:42 -04:00
filters Merge pull request #3942 from hs0210/work 2020-02-18 12:05:22 -08:00
gc vendor: update gotest.tools v3.0.2 2020-02-28 17:47:20 +01:00
identifiers Clarify requirements for identifiers validation 2019-11-04 21:22:10 -05:00
images Merge pull request #4414 from dmcgowan/discard-content 2020-07-24 16:31:46 +09:00
labels Licence header added 2018-02-19 10:32:26 +09:00
leases leases: support resource management 2019-05-29 11:00:32 +08:00
log vendor: update gotest.tools v3.0.2 2020-02-28 17:47:20 +01:00
metadata fix make test failure of missing sha256 package 2020-09-10 18:50:49 +09:00
metrics cgroup2: implement containerd.events.TaskOOM event 2020-06-01 14:00:13 +09:00
mount mount: retry executing the helper binary on ECHILD 2020-07-22 14:24:08 +09:00
namespaces Use common identifiers package with less restrictive regex 2019-11-04 21:22:01 -05:00
oci Add --cpus flag to ctr 2020-07-28 23:06:07 -04:00
pkg Change the type of PdeathSignal 2020-06-11 11:35:51 +09:00
platforms Add RPi1/RPi0 workaround 2020-09-04 14:19:37 -07:00
plugin Replace errors.Cause() with errors.Is() 2020-05-08 14:36:45 +02:00
protobuf/plugin vendor protobuf & grpc 2020-02-26 10:57:05 +09:00
reference Fix panic on reference.Spec.Hostname() 2019-11-11 13:53:31 +08:00
releases Prepare v1.4.0 2020-08-16 22:56:31 -07:00
remotes Log unexpected responses 2020-09-03 14:52:11 +01:00
reports Perfect documentation 2019-09-25 16:59:31 +08:00
rootfs Do not loose snapshotter options 2020-03-02 13:48:41 -08:00
runtime Merge pull request #4538 from fuweid/update-shim-cleanup 2020-09-21 13:32:40 -04:00
script/setup Remove unused Travis configuration 2020-09-21 21:15:42 -07:00
services cr: fix checkpoint from image getting skipped 2020-09-08 16:44:03 +00:00
snapshots devicemapper: seperate implementation pkg from plugin pkg 2020-09-18 12:00:14 +02:00
sys Add support for NetBSD 2020-09-22 20:03:50 +02:00
test testing out k8s prow test move 2020-09-17 17:31:18 -05:00
vendor Merge pull request #4538 from fuweid/update-shim-cleanup 2020-09-21 13:32:40 -04:00
version Prepare v1.4.0 2020-08-16 22:56:31 -07:00
.gitignore Add CRI release functionality to makefile 2020-09-23 14:10:27 -07:00
.golangci.yml Increase golangci-lint timeout 2020-03-17 11:07:23 -04:00
.mailmap Prepare v1.4.0 2020-08-16 22:56:31 -07:00
.zuul.yaml Change nodeset to ubuntu-xenial-arm64-openlab 2020-07-30 09:22:38 +08:00
ADOPTERS.md Add more adopters to ADOPTERS.md 2019-12-20 11:27:50 -05:00
benchmark_test.go Add testing log context 2019-07-16 10:31:43 -07:00
BUILDING.md BUILDING.md: fix description about static builds 2020-08-12 18:39:48 +09:00
client_opts.go Set content labels based on content type 2020-07-21 00:46:07 -07:00
client_test.go Always report server log from verbose integration test runs 2020-07-28 22:33:59 +10:00
client_ttrpc_test.go fix dial error when clean up a dead shim 2020-03-12 10:57:55 +08:00
client_unix_test.go Fix client tests to work on Windows. 2020-05-27 10:42:23 -07:00
client_windows_test.go Import Windows manifest into test build, rather than copying by script 2020-07-29 06:02:35 +10:00
client.go Set content labels based on content type 2020-07-21 00:46:07 -07:00
code-of-conduct.md Add code of conduct 2017-04-04 09:41:38 -07:00
codecov.yml Set codecov to not comment on PRs 2020-05-13 09:19:42 -04:00
container_checkpoint_opts.go Copy annotations around where necessary 2019-03-06 12:26:23 -05:00
container_checkpoint_test.go Add testing log context 2019-07-16 10:31:43 -07:00
container_linux_test.go Add Spec() method to task 2020-07-27 21:32:15 -04:00
container_opts_unix.go Make unique snapshotter opt for label-assisted remapping 2020-06-26 13:14:28 -04:00
container_opts.go Replace errors.Cause() with errors.Is() 2020-05-08 14:36:45 +02:00
container_restore_opts.go Support configurable default platform in the client. 2019-09-03 13:34:25 -07:00
container_test.go CI: add back shim v1 test 2020-07-16 10:40:47 +09:00
container.go Add Spec() method to task 2020-07-27 21:32:15 -04:00
containerd.service Merge pull request #4475 from thaJeztah/minor_systemd_updates 2020-08-18 00:15:14 +08:00
containerstore.go Add containers streaming API 2018-07-26 13:55:20 -04:00
content_test.go Fix cleanup error on content client test 2019-11-26 11:22:35 -08:00
daemon_config_linux_test.go cgroup2 CI 2020-05-22 01:15:12 +09:00
daemon_test.go linux: fix runtime-root propagation 2018-03-05 15:01:22 +09:00
diff.go Add unpack opts 2019-08-07 18:35:55 +00:00
events.go bugfix: return the context error during event subscribe 2018-10-24 19:25:57 +08:00
export_test.go Add testing log context 2019-07-16 10:31:43 -07:00
export.go Update image export to support Docker format 2019-04-04 15:23:06 -07:00
grpc.go Switch from x/net/context to context 2018-04-24 14:33:34 -07:00
helpers_unix_test.go Licence header added 2018-02-19 10:32:26 +09:00
helpers_windows_test.go Fix client tests to work on Windows. 2020-05-27 10:42:23 -07:00
image_store.go Copy annotations around where necessary 2019-03-06 12:26:23 -05:00
image_test.go Fix image usage calculation error 2020-05-20 08:44:05 -04:00
image.go Fix image usage calculation error 2020-05-20 08:44:05 -04:00
import_test.go Remove an empty line 2019-12-20 17:19:41 +08:00
import.go Support configurable default platform in the client. 2019-09-03 13:34:25 -07:00
install_opts.go Add optional install path 2018-09-11 10:36:00 -04:00
install.go create local version of introspection service 2020-01-02 12:34:23 -08:00
lease_test.go Replace errors.Cause() with errors.Is() 2020-05-08 14:36:45 +02:00
lease.go WithLease: always return context and done fn 2020-04-25 21:16:43 -07:00
LICENSE Edit Containerd license info so GitHub recognizes it 2018-04-02 12:31:15 -07:00
Makefile Add CRI release functionality to makefile 2020-09-23 14:10:27 -07:00
Makefile.darwin Licence header added 2018-02-19 10:32:26 +09:00
Makefile.freebsd Licence header added 2018-02-19 10:32:26 +09:00
Makefile.linux riscv64 arch does not support -buildmode=pie 2020-05-20 16:28:10 -03:00
Makefile.windows Better support windows binaries. 2019-11-12 11:52:49 -08:00
namespaces.go Add cgroup delete opt for ns deletion 2019-07-01 15:01:02 -04:00
NOTICE Update readme and documentation for release 2015-12-16 12:15:22 -08:00
PLUGINS.md Document plugins 2018-07-25 23:28:09 -07:00
process.go Word spelling correction 2019-09-25 16:49:54 +08:00
Protobuild.toml Add proto path /usr/include to Protobuild 2019-11-07 14:36:54 -05:00
pull.go Set content labels based on content type 2020-07-21 00:46:07 -07:00
README.md add help wanted, update slack 2020-08-31 12:41:28 -05:00
RELEASES.md Update latest release in RELEASES.md 2020-09-15 19:10:12 -07:00
ROADMAP.md Update roadmap.md with issue labels and milestones 2018-01-04 10:47:06 -05:00
RUNC.md fix RUNC.md vs vendor.conf mismatch 2018-05-11 13:56:54 +09:00
SCOPE.md Update usage of whitelist in project 2020-06-08 12:49:22 -05:00
services.go create local version of introspection service 2020-01-02 12:34:23 -08:00
signals_test.go ParseSignal: drop add'l check for numeric signals 2020-03-17 14:17:03 -07:00
signals_unix.go ParseSignal: drop add'l check for numeric signals 2020-03-17 14:17:03 -07:00
signals_windows.go Use unix.SignalNum in ParseSignal on unix platform 2019-03-03 22:10:58 +08:00
signals.go Use unix.SignalNum in ParseSignal on unix platform 2019-03-03 22:10:58 +08:00
snapshot_test.go Licence header added 2018-02-19 10:32:26 +09:00
snapshotter_default_linux.go Licence header added 2018-02-19 10:32:26 +09:00
snapshotter_default_unix.go enable native (formerly naive) snapshotter by default 2018-04-02 13:29:19 +09:00
snapshotter_default_windows.go Licence header added 2018-02-19 10:32:26 +09:00
snapshotter_opts_unix.go Make unique snapshotter opt for label-assisted remapping 2020-06-26 13:14:28 -04:00
task_opts_unix_test.go move WithXXXX to task_opts.go 2018-09-10 15:24:01 +08:00
task_opts_unix.go support user remapping in ctr 2019-12-12 01:16:47 -06:00
task_opts.go Merge pull request #3000 from stefanberger/descriptor_annotations.pr 2019-03-22 14:05:44 -04:00
task.go Add Spec() method to task 2020-07-27 21:32:15 -04:00
unpacker.go Set content labels based on content type 2020-07-21 00:46:07 -07:00
Vagrantfile update to golang 1.15.2 2020-09-11 09:21:25 +02:00
vendor.conf Merge pull request #4538 from fuweid/update-shim-cleanup 2020-09-21 13:32:40 -04:00

containerd banner

GoDoc Build Status Windows Build Status Nightlies FOSSA Status Go Report Card CII Best Practices

containerd 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.

containerd is a member of CNCF with 'graduated' status.

containerd is designed to be embedded into a larger system, rather than being used directly by developers or end-users.

architecture

Now Recruiting

We are a large inclusive OSS project that is welcoming help of any kind shape or form:

  • Documentation help is needed to make the product easier to consume and extend.
  • We need OSS community outreach / organizing help to get the word out; manage and create messaging and educational content; and to help with social media, community forums/groups, and google groups.
  • We are actively inviting new security advisors to join the team.
  • New sub-projects are being created, core and non-core that could use additional development help.
  • Each of the containerd projects has a list of issues currently being worked on or that need help resolving.
    • If the issue has not already been assigned to someone, or has not made recent progress and you are interested, please inquire.
    • If you are interested in starting with a smaller / beginner level issue, look for issues with an exp/beginner tag, for example containerd/containerd beginner issues.

Getting Started

See our documentation on containerd.io:

See how to build containerd from source at BUILDING.

If you are interested in trying out containerd see our example at Getting Started.

Nightly builds

There are nightly builds available for download here. Binaries are generated from master branch every night for Linux and Windows.

Please be aware: nightly builds might have critical bugs, it's not recommended for use in prodution and no support provided.

Runtime Requirements

Runtime requirements for containerd are very minimal. Most interactions with the Linux and Windows container feature sets are handled via runc and/or OS-specific libraries (e.g. hcsshim for Microsoft). The current required version of runc is always listed in RUNC.md.

There are specific features used by containerd core code and snapshotters that will require a minimum kernel version on Linux. With the understood caveat of distro kernel versioning, a reasonable starting point for Linux is a minimum 4.x kernel version.

The overlay filesystem snapshotter, used by default, uses features that were finalized in the 4.x kernel series. If you choose to use btrfs, there may be more flexibility in kernel version (minimum recommended is 3.18), but will require the btrfs kernel module and btrfs tools to be installed on your Linux distribution.

To use Linux checkpoint and restore features, you will need criu installed on your system. See more details in Checkpoint and Restore.

Build requirements for developers are listed in BUILDING.

Features

Client

containerd offers a full client package to help you integrate containerd into your platform.


import (
  "github.com/containerd/containerd"
  "github.com/containerd/containerd/cio"
)


func main() {
	client, err := containerd.New("/run/containerd/containerd.sock")
	defer client.Close()
}

Namespaces

Namespaces 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.

To set a namespace for requests to the API:

context = context.Background()
// create a context for docker
docker = namespaces.WithNamespace(context, "docker")

containerd, err := client.NewContainer(docker, "id")

To set a default namespace on the client:

client, err := containerd.New(address, containerd.WithDefaultNamespace("docker"))

Distribution

// pull an image
image, err := client.Pull(context, "docker.io/library/redis:latest")

// push an image
err := client.Push(context, "docker.io/library/redis:latest", image.Target())

Containers

In 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.

redis, err := client.NewContainer(context, "redis-master")
defer redis.Delete(context)

OCI Runtime Specification

containerd 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.

You can specify options when creating a container about how to modify the specification.

redis, err := client.NewContainer(context, "redis-master", containerd.WithNewSpec(oci.WithImageConfig(image)))

Root Filesystems

containerd allows you to use overlay or snapshot filesystems with your containers. It comes with builtin support for overlayfs and btrfs.

// pull an image and unpack it into the configured snapshotter
image, err := client.Pull(context, "docker.io/library/redis:latest", containerd.WithPullUnpack)

// allocate a new RW root filesystem for a container based on the image
redis, err := client.NewContainer(context, "redis-master",
	containerd.WithNewSnapshot("redis-rootfs", image),
	containerd.WithNewSpec(oci.WithImageConfig(image)),
)

// use a readonly filesystem with multiple containers
for i := 0; i < 10; i++ {
	id := fmt.Sprintf("id-%s", i)
	container, err := client.NewContainer(ctx, id,
		containerd.WithNewSnapshotView(id, image),
		containerd.WithNewSpec(oci.WithImageConfig(image)),
	)
}

Tasks

Taking 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.

// create a new task
task, err := redis.NewTask(context, cio.NewCreator(cio.WithStdio))
defer task.Delete(context)

// the task is now running and has a pid that can be use to setup networking
// or other runtime settings outside of containerd
pid := task.Pid()

// start the redis-server process inside the container
err := task.Start(context)

// wait for the task to exit and get the exit status
status, err := task.Wait(context)

Checkpoint and Restore

If you have criu 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.

// checkpoint the task then push it to a registry
checkpoint, err := task.Checkpoint(context)

err := client.Push(context, "myregistry/checkpoints/redis:master", checkpoint)

// on a new machine pull the checkpoint and restore the redis container
checkpoint, err := client.Pull(context, "myregistry/checkpoints/redis:master")

redis, err = client.NewContainer(context, "redis-master", containerd.WithNewSnapshot("redis-rootfs", checkpoint))
defer container.Delete(context)

task, err = redis.NewTask(context, cio.NewCreator(cio.WithStdio), containerd.WithTaskCheckpoint(checkpoint))
defer task.Delete(context)

err := task.Start(context)

Snapshot Plugins

In addition to the built-in Snapshot plugins in containerd, additional external plugins can be configured using GRPC. An external plugin is made available using the configured name and appears as a plugin alongside the built-in ones.

To add an external snapshot plugin, add the plugin to containerd's config file (by default at /etc/containerd/config.toml). The string following proxy_plugin. will be used as the name of the snapshotter and the address should refer to a socket with a GRPC listener serving containerd's Snapshot GRPC API. Remember to restart containerd for any configuration changes to take effect.

[proxy_plugins]
  [proxy_plugins.customsnapshot]
    type = "snapshot"
    address =  "/var/run/mysnapshotter.sock"

See PLUGINS.md for how to create plugins

Releases and API Stability

Please see RELEASES.md for details on versioning and stability of containerd components.

Downloadable 64-bit Intel/AMD binaries of all official releases are available on our releases page, as well as auto-published to the cri-containerd-release storage bucket.

For other architectures and distribution support, you will find that many Linux distributions package their own containerd and provide it across several architectures, such as Canonical's Ubuntu packaging.

Enabling command auto-completion

Starting with containerd 1.4, the urfave client feature for auto-creation of bash and zsh autocompletion data is enabled. To use the autocomplete feature in a bash shell for example, source the autocomplete/ctr file in your .bashrc, or manually like:

$ source ./contrib/autocomplete/ctr

Distribution of ctr autocomplete for bash and zsh

For bash, copy the contrib/autocomplete/ctr script into /etc/bash_completion.d/ and rename it to ctr. The zsh_autocomplete file is also available and can be used similarly for zsh users.

Provide documentation to users to source this file into their shell if you don't place the autocomplete file in a location where it is automatically loaded for the user's shell environment.

Communication

For async communication and long running discussions please use issues and pull requests on the github repo. This will be the best place to discuss design and implementation.

For sync communication catch us in the #containerd and #containerd-dev slack channels on Cloud Native Computing Foundation's (CNCF) slack - cloud-native.slack.com. Everyone is welcome to join and chat. Get Invite to CNCF slack.

Security audit

A third party security audit was performed by Cure53 in 4Q2018; the full report is available in our docs/ directory.

Reporting security issues

If you are reporting a security issue, please reach out discreetly at security@containerd.io.

Licenses

The containerd codebase is released under the Apache 2.0 license. The README.md file, and files in the "docs" folder are licensed under the Creative Commons Attribution 4.0 International License. You may obtain a copy of the license, titled CC-BY-4.0, at http://creativecommons.org/licenses/by/4.0/.

Project details

containerd is the primary open source project within the broader containerd GitHub repository. However, all projects within the repo have common maintainership, governance, and contributing guidelines which are stored in a project repository commonly for all containerd projects.

Please find all these core project documents, including the:

information in our containerd/project repository.

Adoption

Interested to see who is using containerd? Are you using containerd in a project? Please add yourself via pull request to our ADOPTERS.md file.