Prerequisites
I am trying to migrate from docker to podman for production use of some containers. Some of my containers are in need to be assigned IP adresses from a DHCP server in my network, as such I used docker-net-dhcp.
Now, as I understand, while it cannot be used in docker to do this, the macvlan
driver in podman can.
Steps to reproduce
Here are the steps I have done so far:
- Ensure my (physical) network interface exists:
ip addr show enp7s0 2: enp7s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 50:e5:49:36:fd:ee brd ff:ff:ff:ff:ff:ff inet 10.0.1.115/24 brd 10.0.1.255 scope global dynamic enp7s0 valid_lft 59635sec preferred_lft 59635sec inet 10.0.1.22/24 brd 10.0.1.255 scope global secondary dynamic enp7s0:1002 valid_lft 59635sec preferred_lft 59635sec [ipv6 ommitted]
- Create the podman network:
sudo podman network create -d macvlan -o parent=enp7s0 newnet
and verify
sudo podman network inspect newnet [ { "name": "newnet", "id": "884e74728f045cb5209bbaf5e5cf35f1ab7640b11e74ec988fc08ddf97575cf7", "driver": "macvlan", "network_interface": "enp7s0", "created": "2022-06-19T16:45:29.660485744+02:00", "ipv6_enabled": false, "internal": false, "dns_enabled": false, "ipam_options": { "driver": "dhcp" } } ]
- Try setting up a test container from a minimal image, and attach it to the network
newnet
and ask for its ip address:sudo podman run -it --rm --net newnet alpine ip addr WARN[0000] Failed to load cached network config: network newnet not found in CNI cache, falling back to loading network newnet from disk WARN[0000] 1 error occurred: * plugin type="macvlan" failed (delete): cni plugin macvlan failed: error dialing DHCP daemon: dial unix /run/cni/dhcp.sock: connect: no such file or directory Error: plugin type="macvlan" failed (add): cni plugin macvlan failed: error dialing DHCP daemon: dial unix /run/cni/dhcp.sock: connect: no such file or directory
Problem Statement
While I obviously can see what went wrong here, I don’t have any idea how to fix it. Can you point me in the right direction?
Additional Information
Debian version
sudo lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Installed Packages (shortened to relevant ones)
sudo apt list --installed
Listing... Done
containerd.io/bullseye,now 1.6.6-1 amd64 [installed]
containernetworking-plugins/unknown,now 100:1.1.1-1 amd64 [installed]
containernetworking/unknown,now 100:1.1.1-1 amd64 [installed,automatic]
containers-common/unknown,now 100:0.48.0-1 amd64 [installed,automatic]
podman/unknown,now 100:4.1.1-1 amd64 [installed]
python3-podman-compose/unknown,now 100:1.0.3-1 all [installed]
python3/stable,now 3.9.2-3 amd64 [installed]
Podman
sudo podman --version
podman version 4.1.1