I have a podman network. Containers can communicate by IPs, but not by the alias/container names. Here is my network settings when inspected:
[
{
"args": {
"podman_labels": {
"com.docker.compose.network": "prom-net",
"com.docker.compose.project": "printer-prometheus",
"com.docker.compose.version": "1.23.2"
}
},
"cniVersion": "0.4.0",
"name": "printer-prometheus_prom-net",
"plugins": [
{
"bridge": "cni-podman3",
"hairpinMode": true,
"ipMasq": true,
"ipam": {
"ranges": [
[
{
"gateway": "10.101.192.129",
"subnet": "10.101.192.128/26"
}
]
],
"routes": [
{
"dst": "0.0.0.0/0"
}
],
"type": "host-local"
},
"isGateway": true,
"type": "bridge"
},
{
"capabilities": {
"portMappings": true
},
"type": "portmap"
},
{
"backend": "",
"type": "firewall"
},
{
"type": "tuning"
}
]
}
]
I am using docker-compose to start the pods.
"Networks": {
"printer-prometheus_prom-net": {
"EndpointID": "",
"Gateway": "10.101.192.129",
"IPAddress": "10.101.192.131",
"IPPrefixLen": 26,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "96:2e:67:d1:45:ec",
"NetworkID": "printer-prometheus_prom-net",
"DriverOpts": null,
"IPAMConfig": null,
"Links": null,
"Aliases": [
"5712fb063d92",
"blackbox_exporter"
]
}
}
},
If I ping either alias or the container name I get ping: bad address '5712fb063d92'
.
I can ping the IP without an issue. Using the same compose file and docker, everything works fine.
Installing dnsname and adding the following to my plugins list in /etc/cni/net.d/network_name solved the issue
{
"type": "dnsname",
"domainName": "dns.podman",
"capabilities": {
"aliases": true
}