chrillof
chrillof

Reputation: 413

Is it possible to list which ports in a Podman pod is bound to which container?

I'm creating a podman pod as follows:

podman pod create --name MyAwesomePod --publish=80:8080

which effectively binds port 80 on the "inside" of my pod to the podman host's port 8080.

I then add containers to the pod using something like

podman run --pod MyAwesomePod --name web myWebServerImage
podman run --pod MyAwesomePod --name db mySqlServer

It is then possible for me to access the container running the web server on port 80 as intended (using localhost:8080). However, I cannot figure out if there is a way to display that the routing is going to this specific container. Running podman ps gives me a list of both my running containers and the PORT column lists 0.0.0.0:8080->80/tcp on both, which of course cannot be true.

Is this a flaw in Podman or have I misunderstood the way pods work?

I am running rootless Podman 3.2.0.

Upvotes: 2

Views: 5857

Answers (1)

jhutar
jhutar

Reputation: 1491

Containers in one pod share same network namespace:

https://podman.io/getting-started/network#podman-pods

You can do netstat -ntlp on a host machine, but that that point only to a conmon process and I do not know how to track final process from there:

[centos@... ~]$ sudo netstat -ntlp | grep 443
tcp        0      0 0.0.0.0:443             0.0.0.0:*               LISTEN      20623/conmon
[centos@... ~]$ ps 20623
  PID TTY      STAT   TIME COMMAND
20623 ?        Ssl    0:00 /usr/bin/conmon --api-version 1 -s -c 8084f02f601782166aa3345517235cab499680c54276cbd032530ecdaa998469 -u 8084f02f601782166aa3345517235cab499680c54276cbd032530ecdaa998469 -r /usr/bin/runc -b /var/lib/containers/

Anyway I'm on bit older Podman here:

[centos@2dprot-webserver ~]$ rpm -q podman
podman-1.6.4-29.el7_9.x86_64

Upvotes: -2

Related Questions