I read all I could find, but documentation on this scenario is scant or unclear for podman. I have the following (contrived) ROOTLESS podman setup:
pod-1 name:
pod1Container names in
pod1:p1c1-- This is also it's assignedhostnamewithinpod1p1c2-- This is also it's assignedhostnamewithinpod1p1c3-- This is also it's assignedhostnamewithinpod1
pod-2 name:
pod2Container names in
pod2:p2c1-- This is also it's assignedhostnamewithinpod2p2c2-- This is also it's assignedhostnamewithinpod2p2c3-- This is also it's assignedhostnamewithinpod2
I keep certain containers in different pods specifically to avoid port conflict, and to manage containers as groups.
QUESTION:
Give the above topology, how do I communicate between, say, p1c1 and p2c1? In other words, step-by-step, what podman(1) commands do I issue to collect the necessary addressing information for pod1:p1c1 and pod2:p2c1, and then use that information to configure applications in them so they can communicate with one another?
Thank you in advance!
EDIT: For searchers, additional information can be found here.
Podman doesn't have anything like the "services" concept in Swarm or Kubernetes to provide for service discovery between pods. Your options boil down to:
For the first solution, we'd start by creating a network:
And then creating both pods attached to the
sharednetwork:With both pods running on the same network, containers can refer to the other pod by name. E.g, if you were running a web service in
p1c1on port 80, inp2c1you couldcurl http://pod1.For the second option, you would do something like:
Now if
p1c1has a service listening on port1234, you can access that fromp2c1at<some_host_address>:1234.That's correct. Each pod runs with its own network namespace (effectively, it's own ip address), so services in different pods can listen on the same port.
In general you cannot change the configuration of a pod or a container; you can only delete it and create a new one. Assuming that
podman-composehas relatively complete support for thedocker-compose.yamlformat, you should be able to set up the network correctly in yourdocker-compose.yamlfile (you would create the network manually, and then reference it as anexternalnetwork in your compose file).Here is a link to the relevant Docker documentation. I haven't tried this myself with podman.