So finally a TL;DR for those who just seek a solution. This is now tested and it works.
The symptom
You have network errors in between-container communication (inside of a pod or so), e.g. from a webservice like Nextcloud to the database (MySQL), after upgrading to Fedora 36.
The cause
The issue stems from the fact that Fedora 36 now uses podman 4.0, whcih switched it’s networking mode from CNI to netavark.
How hostnames of pods are resolved has fundamentally changed with that upgrade.
Podman-compose e.g. now also required the podman-dnsname
/podman-plugins
plugin to be installed, but that should already be the case in Fedora 36.
The solution
Please run and check podman info
(shortcut: podman info | grep -i -A3 net
) to see what networking mode you use. If it still says CNI, you should likely switch.
To do so, please create a file /etc/containers/containers.conf
with the following content:
[network]
# Explicitly force "netavark" as to not use the outdated CNI networking, which it would not apply otherwise as long as old stuff is there.
# This may be removed once all containers were upgraded?
# see https://discussion.fedoraproject.org/t/how-to-get-podman-dns-plugin-container-name-resolution-to-work-in-fedora-coreos-36-podman-plugins-podman-dnsname/39493/5?u=rugk
# official doc:
# Network backend determines what network driver will be used to set up and tear down container networks.
# Valid values are "cni" and "netavark".
# The default value is empty which means that it will automatically choose CNI or netavark. If there are
# already containers/images or CNI networks preset it will choose CNI.
#
# Before changing this value all containers must be stopped otherwise it is likely that
# iptables rules and network interfaces might leak on the host. A reboot will fix this.
#
network_backend = "netavark"
All containers should be stopped before and restarted after changing this, but realistically please, just reboot once you have changed this! Stuff may break otherwise, as the docs explain:
Before changing this value all containers must be stopped otherwise it is likely that iptables rules and network interfaces might leak on the host. A reboot will fix this.
For more information, have a look at the configuration file template at /usr/share/containers/containers.conf
or the current manpage/docs of podman online.
Why does not it switch by default?
Because of backward-compatibility. As the docs say, the auto-detection will always choose CNI unless you basically have a fresh podman installation/system:
The default value is empty which means that it will automatically choose CNI or netavark. If there are already containers/images or CNI networks preset it will choose CNI.
Addendum
In case you use podman-compose
, please note you may stumble upon other issues, as the v1.0.3 of the tool does not generate a pod anymore. This is fixed in v1.0.4.