Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support modifying published ports after container start #18309

Closed
deliciouslytyped opened this issue Apr 22, 2023 · 13 comments
Closed

Support modifying published ports after container start #18309

deliciouslytyped opened this issue Apr 22, 2023 · 13 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. network Networking related issue or feature

Comments

@deliciouslytyped
Copy link

deliciouslytyped commented Apr 22, 2023

Feature request description

There does not seem to be any way to change published ports after starting a container.

See also:

I'm new and only now learning containers/podman, so I don't understand any nuances that may make this a deliberate design decision.
Is this a deliberate design decision or just not implemented yet?

I would also like this for network settings in general.

Suggest potential solution

I would like a podman subcommand for modifying port / network settings.

Have you considered any alternatives?

No response

Additional context

No response

@deliciouslytyped deliciouslytyped added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 22, 2023
@deliciouslytyped
Copy link
Author

deliciouslytyped commented Apr 22, 2023

I just realized I was still on 3.4 . Podman 4.1 appears to have a podman network update command, so I imagine that would be a good extension point.
Edit: Actually this is probably not what I think it is.

These two may also be relevant?:

@Luap99
Copy link
Member

Luap99 commented Apr 24, 2023

We really try to avoid changes after the original container creation as much as possible. It is extremely difficult to support that. There are just to many corner cases. I also cannot stress enough that port forwarding in its current form is already extremely hard to maintain for me as there are so many ways to do it.

On a stopped container this may be easy enough to support as we only would need to update the config in the db but for running containers it is just way to difficult.

@Arcitec
Copy link

Arcitec commented May 8, 2023

@Luap99 Being unable to edit port and folder mappings on a stopped container is the only thing holding me back from loving Podman. If a container is stopped, it should be safe to edit these things?

@Luap99 Luap99 added the network Networking related issue or feature label May 9, 2023
@Luap99
Copy link
Member

Luap99 commented May 9, 2023

Yes on a stopped container it is safe (just some db edit to change the mapping there), however exposing such functionality is still code we have to support. And at the point you stopped the container you could just create a new one anyway? Containers should really be treated as immutable for the most part.

@deliciouslytyped
Copy link
Author

deliciouslytyped commented May 11, 2023

Not recommended obviously, but if you really need to do it, I have indeed just edited the config stored in the db.
I haven't been able to find much in terms of BoltDB cli tools, but https://github.com/br0xen/boltbrowser is one, though it's missing some functionality to really make this not a huge pain. However, IIUC there is now an experimental (?) sqlite based backend for podman which should be a lot nicer to do this with.

@github-actions
Copy link

A friendly reminder that this issue had no activity for 30 days.

@rhatdan
Copy link
Member

rhatdan commented Jul 28, 2023

We do not plan on implementing this feature, since you can just use --replace.

@rhatdan rhatdan closed this as completed Jul 28, 2023
@PoneyClairDeLune
Copy link

We do not plan on implementing this feature, since you can just use --replace.

Is there a way to modify published ports when the container is stopped?

@rhatdan
Copy link
Member

rhatdan commented Oct 23, 2023

Sorry no, not in a supported fashion.

@PoneyClairDeLune
Copy link

Sorry no, not in a supported fashion.

Could this be ever implemented? It's possible in Docker, but since Podman uses a database file, it's next to impossible to do so manually.

@Luap99
Copy link
Member

Luap99 commented Oct 26, 2023

There is no plan to ever implement this. The supported way is to recreate the container.

@PoneyClairDeLune
Copy link

There is no plan to ever implement this. The supported way is to recreate the container.

So how to recreate the container while retaining all data present in the previous container?

@Luap99
Copy link
Member

Luap99 commented Oct 26, 2023

Use podman commit to commit the container to an image, then you can run a new container based on the created image.
But in general it is best to just keep your data on volumes and not in the image.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Jan 25, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. network Networking related issue or feature
Projects
None yet
Development

No branches or pull requests

5 participants