Open sanmai-NL opened 2 days ago
Please share the exact command you use to create the container and how do you run them. Without a proper reproducer it will be impossible to debug this.
From your given container inspect it seems the container ignored the given network and just uses the default podman one. Are you using using podman network connect/disconnect by any chance?
The command is in the podman info
dump, isn't it? I have not yet touched podman network connect
but was planning to try that, will report back in ot.
Aargh, I now noticed the problem. There's a stray --device
parameter right before the networking parameters. That's new and that's why IPAM did work before. Still a defect to solve on Podman side, to validate the --device
parameter and to raise a fault.
$ podman run --device "--network=bb7c9de1d0966a607e8d2d219210641f570e8d947f8d886e3694990bfad19955:ip=172.16.128.2,ip6=fde5:c139:5e49:5ad6::2" quay.io/libpod/testimage:20240123
Error: stat --network=bb7c9de1d0966a607e8d2d219210641f570e8d947f8d886e3694990bfad19955: no such file or directory
That already creates an error for me, it is not clear how you managed to create the container like this.
@Luap99 What's confusing by the way, is what way of specifying static IP addresses is supported given how many IP addresses, networking mode, number of networks. Ideally there would be a single way. Also, the difference between bridge mode and other modes in this respect, for instance in being able to connect networks by ID vs. name, seems to differ from Docker engine's CLI.
$ podman run --device "--network=bb7c9de1d0966a607e8d2d219210641f570e8d947f8d886e3694990bfad19955:ip=172.16.128.2,ip6=fde5:c139:5e49:5ad6::2" quay.io/libpod/testimage:20240123 Error: stat --network=bb7c9de1d0966a607e8d2d219210641f570e8d947f8d886e3694990bfad19955: no such file or directory
That already creates an error for me, it is not clear how you managed to create the container like this.
Which Podman version have you tested?
By the way, I use create
and then run
.
@Luap99 What's confusing by the way, is what way of specifying static IP addresses is supported given how many IP addresses, networking mode, number of networks. Ideally there would be a single way. Also, the difference between bridge mode and other modes in this respect, for instance in being able to connect networks by ID vs. name, seems to differ from Docker engine's CLI.
Please be specific, using name of ID should not matter, the reason there are several ways is because --ip
doesn't scale if you use more than one network. This is the reason why we added the --network name:<options>
syntax, of course we still have this support the other syntax for docker compat.
I tested with podman 4.9.4 and main, and using create
results in the same error.
$ podman run --device "--network=bb7c9de1d0966a607e8d2d219210641f570e8d947f8d886e3694990bfad19955:ip=172.16.128.2,ip6=fde5:c139:5e49:5ad6::2" quay.io/libpod/testimage:20240123 Error: stat --network=bb7c9de1d0966a607e8d2d219210641f570e8d947f8d886e3694990bfad19955: no such file or directory
That already creates an error for me, it is not clear how you managed to create the container like this.
I have minimal reproducer of the defect:
podman container create --device --network=bb7c9de1d0966a607e8d2d219210641f570e8d947f8d886e3694990bfad19955:ip=172.16.128.2,ip6=fde5:c139:5e49:5ad6::2 --privileged -- ghcr.io/siderolabs/talos:v1.7.5
The --privileged
parameter seems to result in silent acceptance of the invalid --device
value.
Ah yes with --privileged
it works. privileged maps all devices so it really doesn't matter what device you give there.
Of course that does not mean we should not validate the option at all.
@Luap99 What's confusing by the way, is what way of specifying static IP addresses is supported given how many IP addresses, networking mode, number of networks. Ideally there would be a single way. Also, the difference between bridge mode and other modes in this respect, for instance in being able to connect networks by ID vs. name, seems to differ from Docker engine's CLI.
Please be specific, using name of ID should not matter, the reason there are several ways is because
--ip
doesn't scale if you use more than one network. This is the reason why we added the--network name:<options>
syntax, of course we still have this support the other syntax for docker compat.I tested with podman 4.9.4 and main, and using
create
results in the same error.
If you mean with specific, provide more support for the claim that ID vs. name is accepted based on networking mode, then please consider this excerpt from the podman create
docs:
[:OPTIONS,…]: Connect to a user-defined network; this is the network name or ID from a network created by [podman network create](https://docs.podman.io/en/latest/markdown/podman-network-create.1.html). **Using the network name implies the bridge network mode.** It is possible to specify the same options described under the bridge mode above.
As my custom network has ipvlan
mode, identifying the network by name does not respect the instructions here.
Bridge network mode != bridge network driver, the bridge mode is really more of a internal detail and is the same thing as the custom (user-defined) networks
I suppose you can see why that's confusing. Perhaps it's possible to move implementation or design details from the user docs to dev docs.
yes of course
I suppose Using the network name implies the bridge network mode
can be dropped entirely it doesn't add any helpful context. The It is possible to specify the same options described under the bridge mode above.
is the relevant part for users.
Issue Description
I cannot reliably assign static IP addresses, and force to use the custom network in the first place. I've tried multiple ways to specifcy the network and the static IP addresses, and this method seems to fully comply with the (confusing) instructions in the
podman create
docs.Steps to reproduce the issue
Create a container that matches this inspect dump:
And a network that matches this
network inspect
dump:Describe the results you received
Sometimes (not always, with the same invocation) another IP-address in a custom network's subnet is assigned. Sometimes, the custom network isn't selected but rather the default network
podman
, and IP-addresses in its subnet.Describe the results you expected
I expect any fault condition, such as specifying a custom network that cannot be found or used for some reason, to cause a fatal fault, rather than silently reverting to the default network. I also expect that custom networks can be specified including IP address assignment.
podman info output
Podman in a container
No
Privileged Or Rootless
Privileged
Upstream Latest Release
No
Additional environment details
Additional environment details
Additional information
Client: Podman Engine Version: 4.9.3 API Version: 4.9.3 Go Version: go1.22.1 Built: Thu Jan 1 01:00:00 1970 OS/Arch: linux/amd64