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: supporting adding new bind mounts on existing containers #1320

Closed
jlebon opened this issue Aug 22, 2018 · 8 comments
Closed

RFE: supporting adding new bind mounts on existing containers #1320

jlebon opened this issue Aug 22, 2018 · 8 comments
Labels

Comments

@jlebon
Copy link
Contributor

@jlebon jlebon commented Aug 22, 2018

E.g. something like podman bind-mount my-running-container /host/path:/cnt/path. This is really useful if you've got a pet container with a lot of state and would rather not rebuild it.

I've been able to do this in the past with docker containers using nsenter as described here though it'd be great if there was a built-in command to handle this.

@mheon

This comment has been minimized.

Copy link
Collaborator

@mheon mheon commented Aug 22, 2018

I think temporary mounts would be doable - temporarily mount a new directory into a container. Permanent is more troublesome - everything in libpod is built on the assumption that the core configuration of a container is immutable.

@rhatdan

This comment has been minimized.

Copy link
Member

@rhatdan rhatdan commented Aug 22, 2018

@jlebon So you want a mount point to suddenly appear inside of the container image?

podman bind-mount my-running-container /var/lib/foobar:/var/lib/foobar:Z,ro,rshared

Would nsenter -m into the continers mount namespace and bind mount the host directory on top of the containers directory?

Relabel /var/lib/foobar to work with the SELinux label
mount -o bind /var/lib/foobar $CONTAINERROOTFS:/var/lib/foobar

@jlebon

This comment has been minimized.

Copy link
Contributor Author

@jlebon jlebon commented Aug 22, 2018

I think temporary mounts would be doable

I think restricting this to temporary mounts is totally reasonable. My workflow right now is that I have a helper script that spawns a new pet container if it doesn't already exist, or just resumes it if it does. So permanent modifications means modifying that launch script for the next time I recreate the container. The bind-mount command is more so that I don't have to nuke & recreate it right away.

Would nsenter -m into the continers mount namespace and bind mount the host directory on top of the containers directory?

Yes, exactly!

@mheon mheon added the enhancement label Sep 6, 2018
@rhatdan

This comment has been minimized.

Copy link
Member

@rhatdan rhatdan commented Dec 22, 2018

@mheon Any more thoughts on implementing this?

@mheon

This comment has been minimized.

Copy link
Collaborator

@mheon mheon commented Dec 22, 2018

I think we'd want to do this as part of podman container clone whenever we get around to that

@rhatdan

This comment has been minimized.

Copy link
Member

@rhatdan rhatdan commented Mar 8, 2019

@jlebon Do you still need this or is the nsenter suggestion good enough?

@jlebon

This comment has been minimized.

Copy link
Contributor Author

@jlebon jlebon commented Mar 8, 2019

The nsenter hack is OK, but having a command do it all for me would be cool. Definitely don't need it, but I do want it. :) Feel free to (de)prioritize accordingly.

@mheon

This comment has been minimized.

Copy link
Collaborator

@mheon mheon commented Mar 8, 2019

@rhatdan We can close this and toss it as a use case for container clone (which also closes #376)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.