10.10. Communicating in a pod
You must publish the ports for the container in a pod when a pod is created.
Prerequisites
-
The
container-toolsmeta-package is installed.
Procedure
Create a pod named
web-pod:# podman pod create --name=web-pod-publish -p 80:80List all pods:
# podman pod ls POD ID NAME STATUS CREATED INFRA ID # OF CONTAINERS 26fe5de43ab3 publish-pod Created 5 seconds ago 7de09076d2b3 1Run the web container named
web-containerinside theweb-pod:# podman container run -d --pod web-pod-publish --name=web-container docker.io/library/httpdList containers
# podman ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7de09076d2b3 k8s.gcr.io/pause:3.5 About a minute ago Up 23 seconds ago 0.0.0.0:80->80/tcp 26fe5de43ab3-infra 088befb90e59 docker.io/library/httpd httpd-foreground 23 seconds ago Up 23 seconds ago 0.0.0.0:80->80/tcp web-containerVerify that the
web-containercan be reached:$ curl localhost:80