10.6. Communicating between a container and a host
By default, the podman network is a bridge network. It means that a network device is bridging a container network to your host network.
Prerequisites
-
The
container-toolsmeta-package is installed. -
The
web-containeris running. For more information, see Communicating between a container and an application.
Procedure
Verify that the bridge is configured:
# podman network inspect podman | grep bridge "type": "bridge"Display the host network configuration:
# ip addr show cni-podman0 6: podman0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 link/ether 62:af:a1:0a:ca:2e brd ff:ff:ff:ff:ff:ff inet 10.88.0.1/16 brd 10.88.255.255 scope global podman0 valid_lft forever preferred_lft forever inet6 fe80::60af:a1ff:fe0a:ca2e/64 scope link valid_lft forever preferred_lft foreverYou can see that the
web-containerhas an IP of thepodman0subnet and the network is bridged to the host.Inspect the
web-containerand display its IP address:# podman inspect --format='{{.NetworkSettings.IPAddress}}' web-container 10.88.0.2Access the
web-containerdirectly from the host:$ curl 10.88.0.2:80