Containers Stopped Starting with lima nerdctl run

Recreate the lima vm


Posted on Sun, Apr 17, 2022
Tags lima, containerd
lima, containerd
📝 This article is a translation of the original Japanese post. View original

Containers Stopped Starting When Launched with lima nerdctl run

After upgrading lima with brew, trying to start a container with lima nerdctl run produced the following error.

1
2
3
4
$ lima nerdctl run -ePORT=8080 -d -p 127.0.0.1:8080:8080 your-container:latest

FATA[0051] failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: time="2022-04-17T08:14:05Z" level=fatal msg="failed to call cni.Setup: plugin type=\"isolation\" failed (add): incompatible CNI versions; config is \"1.0.0\", plugin supports [\"0.1.0\" \"0.2.0\" \"0.3.0\" \"0.3.1\" \"0.4.0\"]"
Failed to write to log, write /home/user.linux/.local/share/nerdctl/1935db59/containers/default/595b2dc931510df7ce240487ef836e4af101156299d7776b88e2f798cc2a90dd/oci-hook.createRuntime.log: file already closed: unknown

The versions of lima and nerdctl were as follows.

  • lima : 0.9.2
  • nerdctl : 0.18.0

As of 2022/04/17 these were the latest versions, and looking through the issues I found nothing that seemed to apply.

Summary

The default VM created when lima was installed had not been recreated, so old containerd configuration was left behind.

You can check the VMs created via qemu with limactl list.

1
2
3
$ limactl list
NAME       STATUS     SSH                ARCH      CPUS    MEMORY    DISK      DIR
default    Running    127.0.0.1:60022    x86_64    4       4GiB      100GiB    /Users/user/.lima/default

Even when you update lima, this vm remains, so it had to be deleted and recreated once.

1
2
3
4
5
6
$ limactl delete default
$ limactl start

# started successfully
$ lima nerdctl run -ePORT=8080 -d -p 127.0.0.1:8080:8080 your-container:latest
3a9b933003508556ccc575c013d80d06cb70d14a1225d2f59be519a3930895d3

About lima and containerd

Put simply, lima is a mechanism that uses qemu to create a VM and runs containers using the containerd installed inside it. (The update notifications from Docker for Mac started to bother me, so I’ve come to rely on lima & containerd for building containers.)

I suspect that in this case the image of the VM originally created by lima, and the configuration generated inside it, became incompatible with the updated lima and nerdctl (0.18.0), which led to the error failed to call cni.Setup: plugin type=\"isolation\" failed (add): incompatible CNI versions; config is \"1.0.0\", plugin supports [\"0.1.0\" \"0.2.0\" \"0.3.0\" \"0.3.1\" \"0.4.0\"].

Troubleshooting

Deleting and recreating lima-vm produces a different error

1
2
3
4
5
6
$ lima nerdctl run -ePORT=8080 -d -p 127.0.0.1:8080:8080 your-container:latest

WARN[0000] environment variable XDG_RUNTIME_DIR is not set, see https://rootlesscontaine.rs/getting-started/common/login/
WARN[0000] environment variable XDG_RUNTIME_DIR is not set, see https://rootlesscontaine.rs/getting-started/common/login/
WARN[0000] environment variable XDG_RUNTIME_DIR is not set, see https://rootlesscontaine.rs/getting-started/common/login/
FATA[0000] rootless containerd not running? (hint: use `containerd-rootless-setuptool.sh install` to start rootless containerd): environment variable XDG_RUNTIME_DIR is not set, see https://rootlesscontaine.rs/getting-started/common/login/

This appears to be a known error discussed in nerdctl - rootless containerd not running? · Issue #608 · lima-vm/lima. It also seems to be fixed by recreating the lima-vm.

Restarting really does solve everything…!!

Share