summaryrefslogtreecommitdiffhomepage
path: root/g3doc/user_guide/containerd/configuration.md
blob: 558050bbcb5717dc2a07760a6ae834b5093edd90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Containerd Advanced Configuration

This document describes how to configure runtime options for
`containerd-shim-runsc-v1`. This follows the
[Containerd Quick Start](./quick_start.md) and requires containerd 1.2 or later.

### Update `/etc/containerd/config.toml` to point to a configuration file for `containerd-shim-runsc-v1`.

`containerd-shim-runsc-v1` supports a few different configuration options based
on the version of containerd that is used. For versions >= 1.3, it supports a
configurable `ConfigPath` in the containerd runtime configuration.

```shell
cat <<EOF | sudo tee /etc/containerd/config.toml
disabled_plugins = ["restart"]
[plugins.linux]
  shim_debug = true
[plugins.cri.containerd.runtimes.runsc]
  runtime_type = "io.containerd.runsc.v1"
[plugins.cri.containerd.runtimes.runsc.options]
  TypeUrl = "io.containerd.runsc.v1.options"
  # containerd 1.3 only!
  ConfigPath = "/etc/containerd/runsc.toml"
EOF
```

When you are done restart containerd to pick up the new configuration files.

```shell
sudo systemctl restart containerd
```

### Configure `/etc/containerd/runsc.toml`

> Note: For containerd 1.2, the config file should named `config.toml` and
> located in the runtime root. By default, this is `/run/containerd/runsc`.

The set of options that can be configured can be found in
[options.go](https://github.com/google/gvisor/blob/master/pkg/shim/v2/options.go).

#### Example: Enable the KVM platform

gVisor enables the use of a number of platforms. This example shows how to
configure `containerd-shim-runsc-v1` to use gvisor with the KVM platform.

Find out more about platform in the
[Platforms Guide](../../architecture_guide/platforms.md).

```shell
cat <<EOF | sudo tee /etc/containerd/runsc.toml
[runsc_config]
platform = "kvm"
EOF
```

### Example: Enable gVisor debug logging

gVisor debug logging can be enabled by setting the `debug` and `debug-log` flag.
The shim will replace "%ID%" with the container ID, and "%COMMAND%" with the
runsc command (run, boot, etc.) in the path of the `debug-log` flag.

Find out more about debugging in the [debugging guide](../debugging.md).

```shell
cat <<EOF | sudo tee /etc/containerd/runsc.toml
[runsc_config]
  debug=true
  debug-log=/var/log/%ID%/gvisor.%COMMAND%.log
EOF
```