When a DNS plugin is enabled, use a container name to address containers.
Before you begin
- The
container-tools meta-package is installed.
- A network with the enabled DNS plugin has been created by using the
podman network create command.
Procedure
-
Run a
receiver container attached to the mynet network:
# podman run -d --net mynet --name receiver ubi10 sleep 3000
-
Run a
sender container and reach the receiver container by its name:
# podman run -it --rm --net mynet --name sender alpine ping receiver
PING rcv01 (10.89.0.2): 56 data bytes
64 bytes from 10.89.0.2: seq=0 ttl=42 time=0.041 ms
64 bytes from 10.89.0.2: seq=1 ttl=42 time=0.125 ms
64 bytes from 10.89.0.2: seq=2 ttl=42 time=0.109 ms
Exit using the CTRL+C.
You can see that the sender container can ping the receiver container using its name.