mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 01:29:07 +00:00
add containerd cli opts
Signed-off-by: Avi Deitcher <avi@deitcher.net>
This commit is contained in:
parent
a1427d0b7b
commit
865ed8a1ce
23
docs/faq.md
23
docs/faq.md
@ -37,6 +37,29 @@ If you're not seeing `containerd` logs in the console during boot, make sure tha
|
|||||||
|
|
||||||
`init` and other processes like `containerd` will use the last defined console in the kernel `cmdline`. When using `qemu`, to see the console you need to list `ttyS0` as the last console to properly see the output.
|
`init` and other processes like `containerd` will use the last defined console in the kernel `cmdline`. When using `qemu`, to see the console you need to list `ttyS0` as the last console to properly see the output.
|
||||||
|
|
||||||
|
## Enabling debug or trace log levels on containerd
|
||||||
|
|
||||||
|
On startup, linuxkit looks for and parses a file `/etc/containerd/cli-opts`. If it exists, the content is used as arguments to containerd. Thus, to enable
|
||||||
|
a higher log level, for example `debug`, create a file whose contents are `--log-level debug` and place it on the image:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
files:
|
||||||
|
- path: /etc/containerd/cli-opts
|
||||||
|
contents: "--log-level debug"
|
||||||
|
```
|
||||||
|
|
||||||
|
Note that the package that parses the contents splits on _all_ whitespace. It does not, as of this writing, support shell-like parsing, so the following will work:
|
||||||
|
|
||||||
|
```
|
||||||
|
--log-level debug --arg abcd
|
||||||
|
```
|
||||||
|
|
||||||
|
while the following will not:
|
||||||
|
|
||||||
|
```
|
||||||
|
--log-level debug --arg 'abcd def'
|
||||||
|
```
|
||||||
|
|
||||||
## Troubleshooting containers
|
## Troubleshooting containers
|
||||||
|
|
||||||
Linuxkit runs all services in a specific `containerd` namespace called `services.linuxkit`. To list all the defined containers:
|
Linuxkit runs all services in a specific `containerd` namespace called `services.linuxkit`. To list all the defined containers:
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -17,6 +18,10 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
containerdOptsFile = "/etc/containerd/cli-opts"
|
||||||
|
)
|
||||||
|
|
||||||
func cleanupTask(ctx context.Context, ctr containerd.Container) error {
|
func cleanupTask(ctx context.Context, ctr containerd.Container) error {
|
||||||
task, err := ctr.Task(ctx, nil)
|
task, err := ctr.Task(ctx, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -78,8 +83,14 @@ func systemInitCmd(ctx context.Context, args []string) {
|
|||||||
// remove (unlikely) old containerd socket
|
// remove (unlikely) old containerd socket
|
||||||
_ = os.Remove(*sock)
|
_ = os.Remove(*sock)
|
||||||
|
|
||||||
|
// look for containerd options
|
||||||
|
ctrdArgs := []string{}
|
||||||
|
if b, err := ioutil.ReadFile(containerdOptsFile); err != nil {
|
||||||
|
ctrdArgs = strings.Fields(string(b))
|
||||||
|
}
|
||||||
|
|
||||||
// start up containerd
|
// start up containerd
|
||||||
cmd := exec.Command(*binary)
|
cmd := exec.Command(*binary, ctrdArgs...)
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user