containerd / containerd/nerdctl

failed to call cni.Setup: plugin type="macvlan" failed (add): Link not found

Open
#2,490 5 comments 0 reactions 0 assignees View on GitHub
area/network area/rootless question
Dominant language
Go
Stars
10.4k
Forks
826
Avg merge
1d 23h
Merged PRs (30d)
44

Description

### Description

I want to create a container with macvlan network. But it failed when start container. It reports "Link not found" but actually the network device is existed.

I have read the [document](https://github.com/containerd/nerdctl/blob/main/docs/cni.md#macvlanipvlan-networks).

### Steps to reproduce the issue

1. `nerdctl network create adguard --driver macvlan -o mode=bridge -o parent=enp1s0 --gateway=192.168.1.2 --subnet=192.168.1.0/24`
2. `nerdctl run -it --network adguard adguard/adguardhome:v0.107.38`

### Describe the results you received and expected

```
> nerdctl run -it --network adguard adguard/adguardhome:v0.107.38
FATA[0000] 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="2023-09-13T03:07:37+08:00" level=fatal msg="failed to call cni.Setup: plugin type=\"macvlan\" failed (add): Link not found"
Failed to write to log, write /home/adoyle/.local/share/nerdctl/1935db59/containers/default/2a881648d06c97c85bca42b7797149c253621e64427abd10731d955f3d8379f3/oci-hook.createRuntime.log: file already closed: unknown
```

```
> cat ~/.config/cni/net.d/nerdctl-adguard.conflist
{
"cniVersion": "1.0.0",
"name": "adguard",
"nerdctlID": "253c581cf9cdef5cb2731ce55dbc714d3650056b663f9b3f60c5511f2f4e8436",
"nerdctlLabels": {},
"plugins": [
{
"type": "macvlan",
"master": "enp1s0",
"mode": "bridge",
"ipam": {
"ranges": [
[
{
"gateway": "192.168.1.2",
"subnet": "192.168.1.0/24"
}
]
],
"routes": [
{
"dst": "0.0.0.0/0"
}
],
"type": "host-local"
}
}
]
}
```

The `enp1s0` device is existed.

```
> ip a show enp1s0
2: enp1s0: mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 7c:83:34:b9:d3:d1 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.12/24 brd 192.168.1.255 scope global dynamic enp1s0
valid_lft 79415sec preferred_lft 79415sec
inet6 fe80::c930:f189:d3ba:fe04/64 scope link noprefixroute
valid_lft forever preferred_lft forever
```

### What version of nerdctl are you using?

nerdctl version 1.5.0
rootless installed.

### Are you using a variant of nerdctl? (e.g., Rancher Desktop)

None

### Host information

Client:
Namespace: default
Debug Mode: false

Server:
Server Version: v1.7.2
Storage Driver: overlayfs
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Log: fluentd journald json-file syslog
Storage: native overlayfs
Security Options:
seccomp
Profile: default
cgroupns
rootless
Kernel Version: 6.3.9-arch1-1
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.4GiB
Name: A02
ID: 7ad6f773-a5c1-4e54-9d91-c881dfd0972a

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.