koseduhemak
koseduhemak

Reputation: 551

Podman: add ports to expose to running pod

Is it possible to expose additionally ports for a pod that is already running? If I create a new pod I would supply them with podman pod create ... -p 8080:80.

However, I don‘t want to throw my pod away, just modify it to expose another port.

Upvotes: 4

Views: 22935

Answers (3)

Camilo Flórez
Camilo Flórez

Reputation: 19

You cannot modify port publishing after pod creation.
From --publish in podman pod create command documentation:

Note: This cannot be modified once the pod is created.

Upvotes: -1

kanelbulleproductions
kanelbulleproductions

Reputation: 101

As already mentioned, you cannot edit the pod networking settings, without stopping it and recreating it.

However, what you can do, is to change the pod to not shared networking mode, meaning that containers themselves have power over portmapping and making it possible, that containers do not open all ports opened by the pod

simply run podman pod create without the default share
so simply add this to pod create --share cgroup,ipc,uts
default is cgroup,ipc,net,uts

check podman pod create --help or this for more information about pods.

Upvotes: 5

Dominic P
Dominic P

Reputation: 2404

I'm still pretty new to podman, but as I understand this article what you're trying to accomplish is not possible:

once the pod is created these attributes are assigned to the “infra” container and cannot be changed. For example, if you create a pod and then later decide you want to add a container that binds new ports, Podman will not be able to do this. You would need to recreate the pod with the additional port bindings before adding the new container.

Upvotes: 3

Related Questions