-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Proposal: Add support to mount an image or a container #18701
Comments
If I understand correctly, you want to access the (new) rw-layer from the host, not inside the container, then manipulate files in the rw-layer, and commit the results to a new image? |
@thaJeztah Yes, your understanding for image mount is correct. But for container mount, we will not commit a new image, it is also a container. |
I think we can use host's gdb to debug a coredump inside container image, host's tool to investigate logs or report in containers without exporting the container image to tar ball. And we can modify container even if the app container doesn't contain an editor or shell. |
Won't i.e.,
|
Hi @thaJeztah , TBH, the docker cp way looks not convenient to me. What's more, the idea of docker mount would work on image not only container from the description from @zhuguihua . That means, mount is providing a feature similar with libguestfs . I think that's helpful 😄 |
@thaJeztah docker cp cannot edit image directly. If you want to update it, you must start a container with the image firstly. It is not convenient for users. |
For my case, at debugging, a user need to extract a runtime and all required library from a container which is scattered over a file tree in the container, installed automatically by docker build. That's a pain. He'll not want to install gdb and debuginfo into the container at docker build. It's good to have some way to examine container's contents with tools in a host without copying. |
I agree with @thaJeztah, the proper way to copy files from a docker daemon host to the a docker cli host is through |
@dmcgowan For image, this command could have a function similar to libguestfs, it could edit config file in image before starting a container. For container, this command is helpful for debugging like @hkamezawa saying. |
can't this be thought an external tool for just doing this and handle the logic of mounting/not mounting based on container's state? not a user, can't libguestfs be extended to mount/inspect docker containers/images? :) btw, this seems really something for an external tool to me |
We have already discussed with libguestfs's guys, it is not so good for implementing this feature to mount docker images. Do you have some advice about other external tools to achieve this? @runcom |
Images aren't supposed to be modified. Images are meant to be immutable and containers are supposed to be mutable. The right way to modify an image is to create a container using that image, make any desired changes to the container and commit that container as a new image. Additionally, images can also be edited using export and import. Adding new top level commands such as |
Background
Currently, image handling is based on
Problems
Design
We will realize a feature similar to libguestfs.
The text was updated successfully, but these errors were encountered: