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

Move container to pod #3979

Closed
abitrolly opened this issue Sep 10, 2019 · 30 comments · Fixed by #13587
Closed

Move container to pod #3979

abitrolly opened this issue Sep 10, 2019 · 30 comments · Fixed by #13587
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.

Comments

@abitrolly
Copy link
Contributor

/kind feature

Is it possible to move container into a pod? I want to expose container ports without killing it (#3949) and I thought that maybe moving it to a pod can accomplish this.

Output of podman version:

➜  ~ podman version
Version:            1.5.1
RemoteAPI Version:  1
Go Version:         go1.12.7
OS/Arch:            linux/amd64
@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 10, 2019
@baude
Copy link
Member

baude commented Sep 10, 2019

you cannot currently do this with podman. we have discussed being able to "add" a container with new ports to a pod but that feature is not implemented yet either.

@rhatdan
Copy link
Member

rhatdan commented Sep 11, 2019

You can add a container to an existing container my combining the namespaces.

@abitrolly
Copy link
Contributor Author

@rhatdan you mean to existing pod? What is the command to combine namespaces?

@rhatdan
Copy link
Member

rhatdan commented Sep 11, 2019

Well all a pod is, is a bunch of containers sharing namespaces (and cgroups)

If I have an existing container and do

podman run --pid container:containerA --net container:containerA --ipc container:containerA ...

Then the two containers will basically work as a pod.

@mheon
Copy link
Member

mheon commented Sep 11, 2019

Actually explicitly restricted - you can only share namespaces with a container in a pod if you are part of the pod. Removal ordering issues - need to be able to remove a pod without leaving straggler containers that want to use its resources.

@abitrolly
Copy link
Contributor Author

abitrolly commented Sep 13, 2019

How does it work in the following user story.

  1. I created container with PostgreSQL named postcon
$ podman run -d --name postcon postgres
  1. I forgot to expose port 5432 to access the db, and instead of restarting container I decide to create a pod name postpod with exposed port, and move container there
$ podman pod create --name postpod -p 5432
  1. Now I need to move the postcon container to postpod pod. Now it gets complicated.

pod is just a namespace and cgroup (that's on kernel level). container is in the pod when its namespace is "combined" with pod namespace. podman doesn't expose interface for combining namespaces.

Is that right?

@rhatdan
Copy link
Member

rhatdan commented Sep 13, 2019

Yes, you can not add an existing container to a pod, because of the conflicts in namespaces, and cgroups.

@abitrolly
Copy link
Contributor Author

Is it possible to detect those conflicts and resolve them one by one manually?

@mheon
Copy link
Member

mheon commented Sep 13, 2019 via email

@abitrolly
Copy link
Contributor Author

@mheon is it possible to make changes to container checkpoints that are used for live migrations https://criu.org/Podman ?

@mheon
Copy link
Member

mheon commented Sep 13, 2019

Not at present - but we'd probably use a similar mechanism for podman clone

@github-actions
Copy link

This issue had no activity for 30 days. In the absence of activity or the "do-not-close" label, the issue will be automatically closed within 7 days.

@vrothberg
Copy link
Member

Added the "do-not-close" label as I'm sure this is something worth adding.

@abitrolly
Copy link
Contributor Author

If I make a checkpoint.

podman container checkpoint -l -e /tmp/chkpt.tar.gz

Why it is not possible to restore it inside a pod?

@adrianreber
Copy link
Collaborator

If I make a checkpoint.

podman container checkpoint -l -e /tmp/chkpt.tar.gz

Why it is not possible to restore it inside a pod?

CRIU cannot handle this currently. If CRIU restores a process running in namespaces, CRIU currently also restores all namespaces. For Podman we introduced the possibility in CRIU to restore a container into an existing network namespace, because Podman uses CNI to create network namespaces and CRIU can now restore a container into an existing network namespace. To restore a process into an existing network namespace is the big difference between Podman's checkpoint/restore support and other container engines.

With this as background it should be possible to extend CRIU to restore a process (container) into an existing set of namespaces (a pod). But this requires work on the CRIU level, runc and Podman level. It is doable, but not something which is being worked on (at least from what I know from the CRIU point of view).

@rhatdan
Copy link
Member

rhatdan commented Feb 17, 2020

Is anyone working on this? Planning to work on this?

@mheon
Copy link
Member

mheon commented Feb 17, 2020

It should be part of podman container clone, which nobody is actively working on. However, the work @baude is doing with create for APIv2 is making clone a lot closer than it once was.

@rhatdan
Copy link
Member

rhatdan commented Jun 9, 2020

@mheon Reminder.

@mheon
Copy link
Member

mheon commented Jun 9, 2020

I have cards for podman container clone, so hopefully this gets done this summer

@adrianreber
Copy link
Collaborator

Not sure what clone is exactly about, but I started to work on enabling restoring a container into an existing PID namespace: checkpoint-restore/criu#1056

@rhatdan
Copy link
Member

rhatdan commented Sep 10, 2020

@mheon Should we merge a bunch of these issues together that requires podman container clone

@mheon
Copy link
Member

mheon commented Sep 10, 2020

@rhatdan Agree, that sounds like a good idea

@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.

@github-actions
Copy link

github-actions bot commented Apr 1, 2021

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

@jmpolom
Copy link

jmpolom commented Aug 30, 2021

The idea of a podman clone subcommand to re-instantiate a container in a pod, etc. is super interesting. Is there any hope that this might soon become a reality?

@github-actions
Copy link

github-actions bot commented Oct 3, 2021

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

opened a PR: #13587

giuseppe added a commit to giuseppe/libpod that referenced this issue Mar 24, 2022
@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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants