10.5. Communicating between a container and an application
You can communicate between a container and an application. An application ports are in either listening or open state. These ports are automatically exposed to the container network, therefore, you can reach those containers using these networks. By default, the web server listens on port 80. Using this procedure, the myubi container communicates with the web-container application.
Prerequisites
-
The
container-toolsmeta-package is installed.
Procedure
Start the container named
web-container:# podman run -dt --name=web-container docker.io/library/httpdList all containers:
# podman ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES b8c057333513 docker.io/library/httpd:latest httpd-foreground 4 seconds ago Up 5 seconds ago web-containerInspect the container and display the IP address:
# podman inspect --format='{{.NetworkSettings.IPAddress}}' web-container 10.88.0.2Run the
myubicontainer and verify that web server is running:# podman run -it --name=myubi ubi10/ubi curl 10.88.0.2:80