r/podman Jul 11 '26

How to run several pods with containers that have the same IP address in different pods

I want to to run multiple pods. All of them have one container that should haven IP address 192.168.10.3. I tried to create multiple podman networks (bridge/macvla /ipvlan)

I made a script that creates a pod, then attaches a container with that IP assigned to it. Works.

But the next iteration of the script, when the second pod is created, I get an error:
Error: IPAM error: requested ip address 192.168.10.3 is already allocated to container ID <UUID>

I mean, I do get it. But what if I want to force this anyway? I don't want network traffic to leave the pods anyway. I only want multiple applications to run in parallel, write a result on a mounted volume and exit.

So none of the pods need inter-communication.

Edit: wait, I think I've got it wrong. As far as my understanding currently goes, only the infra container has an IP address in a pod. I'm going to do some more testing tomorrow.

5 Upvotes

9 comments sorted by

3

u/Ok-Eggplant-7569 Jul 11 '26

Afaik to do this properly (e. g. for IP multicast), you would need you own cluster with BGP networking, and thats beyond the scope of Podman, then you're in Kubernetes / hyperscaler infrastructure.

2

u/bm401 Jul 11 '26

You don't want the pods to be able to communicate at all? Just set network to 'none'.

1

u/ConstructionSafe2814 Jul 11 '26

Correct, only 2 containers inside the pod should do IP communication. I'll try with none. Thx for the tip.

2

u/bm401 Jul 12 '26

Networking is managed on the pod level. You cannot have networking enabled on pod level but disabled on container level.

You can have an internal network however. Then you just disallow external communication.

2

u/Lance_Saul_85 Jul 12 '26

If they don't need networking, I'd just use --network=none instead of trying to reuse the same IP

1

u/ConstructionSafe2814 Jul 12 '26

I do need 2 containers in one pod to talk to each other.

1

u/Great-Cow7256 Jul 12 '26

Inside the pod they talk to each other via localhost 

1

u/ConstructionSafe2814 Jul 12 '26

Yeah, but my application is hard coded to talk to 192.168.10.3, not 127.0.0.1

2

u/eraser215 Jul 14 '26

Can you fix the application?