lima-vm / lima

Linux virtual machines, with a focus on running containers
https://lima-vm.io/
Apache License 2.0
15.52k stars 608 forks source link

nerdctl start fails 2 of 3 times with bridge errors #2539

Closed tmewett closed 2 months ago

tmewett commented 3 months ago

Description

Hi, I am getting this bug on Lima 0.22.0: https://github.com/rancher-sandbox/rancher-desktop/issues/1600

In my case, the container that triggered it was created with:

lima nerdctl run -d --name nats-main -p 4222:4222 -p 6222:6222 -p 8222:8222 nats:latest

As the issue states, I get two different errors in order when successively running lima nerdctl start nats-main:

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="2024-08-08T09:35:07+01:00" level=fatal msg="failed to call cni.Setup: plugin type=\"bridge\" failed (add): failed to allocate for range 0: 10.4.0.2 has been allocated to default-2c610b2a32ec35afe90575d534b2bc30b563b078bba0f5eba409f122f1b3ca3f, duplicate allocation is not allowed"
Failed to write to log, write /home/tommewett.linux/.local/share/nerdctl/1935db59/containers/default/2c610b2a32ec35afe90575d534b2bc30b563b078bba0f5eba409f122f1b3ca3f/oci-hook.createRuntime.log: file already closed: unknown

...

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="2024-08-08T09:35:51+01:00" level=fatal msg="failed to call cni.Setup: plugin type=\"bridge\" failed (add): failed to set bridge addr: could not set bridge's mac: invalid argument"
Failed to write to log, write /home/tommewett.linux/.local/share/nerdctl/1935db59/containers/default/2c610b2a32ec35afe90575d534b2bc30b563b078bba0f5eba409f122f1b3ca3f/oci-hook.createRuntime.log: file already closed: unknown

After that, it succeeds.

I thought I would duplicate the report here, as I assume Rancher uses Lima.

macOS 14.6, VM type: vz

AkihiroSuda commented 3 months ago

Could you report to https://github.com/containerd/nerdctl/issues

tmewett commented 3 months ago

Ah, looks like the "failed to allocated" bridge issue has been reported a few times:

apostasie commented 2 months ago

@tmewett this got fixed in https://github.com/containerd/nerdctl/pull/3356 and will end-up in nerdctl v2.