3

I am sure this was asked a million times but I just cannot find anything online for some reason.

I have two network I created with Podman (similar to Docker).

When I do localhost:9998 it just times out.

So it just can't connect.

Is there a way to create net bridge so that I can curl my container in a specific container network?

UPDATE

[
{
    "cniVersion": "0.4.0",
    "name": "search",
    "plugins": [
        {
            "bridge": "cni-podman0",
            "ipMasq": true,
            "ipam": {
                "ranges": [
                    [
                        {
                            "gateway": "10.89.0.1",
                            "subnet": "10.89.0.0/24"
                        }
                    ]
                ],
                "routes": [
                    {
                        "dst": "0.0.0.0/0"
                    }
                ],
                "type": "host-local"
            },
            "isGateway": true,
            "type": "bridge"
        },
        {
            "capabilities": {
                "portMappings": true
            },
            "type": "portmap"
        },
        {
            "backend": "iptables",
            "type": "firewall"
        }
    ]
}

]

0
0

You can use podman inspect <container-name> to get the IP Address of the container.

This command here returns just the IP address:

podman inspect <container-name> --format '{{.NetworkSettings.IPAddress}}'
1
  • Doesn't work: Error: Template parsing error: template: image:1:18: executing "image" at <.NetworkSettings.IPA...>: can't evaluate field NetworkSettings in type *inspect.ImageData – Semo Apr 1 '20 at 7:28
0

From what I was reading I needed to get the gateway IP from podman network inspect search

It was: 10.89.0.1

When I CURL that IP it still didn't work.

But then I found this in the IPtables :

Chain INPUT (policy DROP)
...

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
CNI-FORWARD  all  --  anywhere             anywhere             /* CNI firewall plugin rules */

Chain OUTPUT (policy ACCEPT)
...        

 Chain CNI-FORWARD (1 references)
target     prot opt source               destination         
...
ACCEPT     all  --  anywhere             10.89.0.20           ctstate RELATED,ESTABLISHED
ACCEPT     all  --  10.89.0.20           anywhere            
ACCEPT     all  --  anywhere             10.89.1.2            ctstate RELATED,ESTABLISHED
ACCEPT     all  --  10.89.1.2            anywhere            

...

The IPs 10.89.0.20 and 10.89.1.2 are the IPs for my host to have access to each of the podman networks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.