There are some special cases that you only want to create a container without network interfaces, so you can handle the network directly.
Podman networking uses CNI to configure the networking of the containers, so we can leverage that to create containers without network interfaces, however, we always need the special loopback interface to be UP, so the networking working inside of the namespace.
Podman creates the network configuration in a special folder. We can create a file directly on that folder, or we can modify the files in that folder to suit our needs. Let's see how this works:
- Create a new podman network, it will output the network configuration file
$ podman network create networkless
/etc/cni/net.d/networkless.conflist
- Modify the network configuration file from previous command, to handle ONLY the loopback interface, replacing it by this file:
{
"cniVersion": "0.4.0",
"name": "networkless",
"plugins": [
{
"type": "loopback"
}
]
}
- Now we can use that network to create networkless containers:
podman run --network networkless -it alpine ash
/ # ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
Now you can use something to create the network between the containers, I personally use https://github.com/redhat-nfvpe/koko for this, but it's just "simply" linux namespaces networking ;) ...
Have fun, possibilities are infinite now