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

RFE: podman container clone command #9540

Closed
martinetd opened this issue Mar 1, 2021 · 23 comments
Closed

RFE: podman container clone command #9540

martinetd opened this issue Mar 1, 2021 · 23 comments
Assignees
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. stale-issue

Comments

@martinetd
Copy link

martinetd commented Mar 1, 2021

/kind feature

Description

In other issues there are multiple reference to plans to implement 'container clone', but I see no issue that actually tracks such a new command.
( #7555 (comment) points to an issue about container rename that barely made it to 3.0 but no trace of clone there, #376 talks about creating an issue for this as well but nothing has been done that I could see)

Ideally the command would also let modify any of the create arguments on the fly as override from the cloned source, so e.g. podman container clone -p 5000:5000 source_container dest_container overrides bound ports (there need to be some decision on whether that removes any other published ports first or not, for example systemd-style override would just append ports unless an empty parameter was passed first to unset everything)

Also would need an option for image change, and ideally (can't hurt to ask) an option to immediately remove the old one and start in its stead, in which case it could reuse the same name (instead of using a temporary name, stop the old one, rename/start the new one)

Usecases

The most obvious usecase would be pet containers, e.g. for people who keep adding more options over time and end up with a very complex container that is currently very painful to recreate.
I end up never using podman container create and have a breadth of scripts with long lines podman container run for this use case, and killing/rerunning them if I change some option.
it'd be much simpler to podman container clone --replace --whateverchange oldcontainer

A second usecase that won't get much traction would be autoupdate on systems that don't have systemd (e.g. alpine), alpine now has podman in its community repo on its latest version so podman 3 will be widely available and I believe it would make a good "barebone container host" -- but it has no systemd, so autoupdate isn't useable.
A simple script that pulls, check if image changed, and clone/replace would be easy to implement if we could clone containers, but it's neigh impossible right now.

Thanks!

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 1, 2021
@martinetd
Copy link
Author

martinetd commented Mar 1, 2021

On a similar topic, a "create from config" (either the json obtained from podman container inspect or something else) would be great. I couldn't find anything that looks like that but might have missed it.

EDIT: Ah, now I'm looking for that specifically there's podman generate kube/podman play kube which is close, although it restarts with an extra pod I don't need and the generation lacks some properties e.g. devices; something closer to podman might still make sense though.

@github-actions
Copy link

github-actions bot commented Apr 1, 2021

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

@rhatdan
Copy link
Member

rhatdan commented Apr 5, 2021

These requests are great, but opening a PR would help move this forward.

@github-actions
Copy link

github-actions bot commented May 6, 2021

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

@github-actions
Copy link

github-actions bot commented Jun 6, 2021

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

@mheon mheon self-assigned this Jul 6, 2021
@github-actions
Copy link

github-actions bot commented Aug 6, 2021

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

@rhatdan
Copy link
Member

rhatdan commented Aug 6, 2021

@mheon another month, no activity, do you think this will ever be done?

@mheon
Copy link
Member

mheon commented Aug 6, 2021

Now that rename has been added, the incentive to get this done is a lot less. It's an interesting project, but not really high priority. Good candidate for an intern, maybe?

@infiniteregrets
Copy link

I might need some help, but I can work on this in a few weeks

@github-actions
Copy link

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

@github-actions
Copy link

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

@rhatdan
Copy link
Member

rhatdan commented Nov 16, 2021

@infiniteregrets @mheon Did either of you work on this?

@infiniteregrets
Copy link

@rhatdan sorry, got really busy with school couldn't get time to work on it

@github-actions
Copy link

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

@github-actions
Copy link

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

@github-actions
Copy link

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

@giuseppe
Copy link
Member

this is done with #13059

@rbertoche
Copy link

rbertoche commented Jun 6, 2022

So does that mean no chance at either editing the json specs or inputting them to a podman command to create a new container?
New clone command seems a nice addition to some usecases but it supports none of the options I would need of it, such as --volume, --publish, --network, --subuidname, --subgidname... This current set of options clone has happen to be mostly of commands I have never used even once before. I'm surprised that there isn't --network, which looks more likely on a general use case than the performance related ones...

@rbertoche
Copy link

One particular issue I would hope to be able to fix with clone is when the bind address I had previously passed in podman run or podman create is not bound on the host anymore, so I can't start the container anymore, even in the case I might be fine without that particular port published. Right now I am forced to create the containers "from scratch" when for some reason addresses in the host needs to change.
It's worth noting that publish does not accept a hostname instead of an IP to bind with, cause that would be another way to fix it and would be considerably easier to deal with than clone even. But anyway, this is not the right issue for discussing that...

@cdoern
Copy link
Contributor

cdoern commented Jun 6, 2022

hi @rbertoche thanks for reaching back out! When implementing a new command, usually not all of the flags are added at once to keep the PR diffs below multiple thousands of lines. That being said, the goal is for all flags for podman create/run to eventually be applicable for clone. Would you like to submit an issue with a priority list of a few flags so I know where to get started?

@yule-sun
Copy link

Is this question still updated? I found that there are many differences between the actual environment and the introduction on the official website. For example, this is a screenshot of the introduction document on the official website.
image

Here's a screenshot of my actual environment, the clone command is missing, I don't know what's going on, and I can't find the documentation for the response.
image
Does anyone know what's going on?

@martinetd
Copy link
Author

your podman version is probably just too old? not sure when it was added but it's present in podman 4.1 here.

@cdoern
Copy link
Contributor

cdoern commented Jul 27, 2022

@yule-sun, saw your email with this question. like @martinetd said, your podman version is out of date. Depending on what OS you are on, you might need to build from source (this github repo) in order to get this feature.

@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 Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
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. stale-issue
Projects
None yet
Development

No branches or pull requests

9 participants