[英]How would I mount docker container filesystem?
How would I mount docker container images so that I could modify them with external tools ? 我如何安装docker容器图像,以便我可以使用外部工具修改它们?
This means: from the docker hosts, mounting the image without launching a container on it, as a normal filesystem. 这意味着:从docker主机,安装映像而不在其上启动容器,作为普通文件系统。 I should'nt need to run a container for this.
我不应该为此运行一个容器。
I'd like to update the image directly this way, then probably send something like docker commit
. 我想以这种方式直接更新图像,然后可能发送像
docker commit
这样的东西。 With lxc
tools (in ubuntu for example) its quite easy as it is directly available to host in /var/lib/lxc/MYCONTAINER/rootfs
. 使用
lxc
工具(例如在ubuntu中)非常简单,因为它可以直接在/var/lib/lxc/MYCONTAINER/rootfs
。
I know about workarounds, but: 我知道解决方法,但是:
Dockerfile
context (and ADD
) is rather convenient nor adapted: I don't have a specific directory to send, but rather would use a combination of tools to change only specific files (think of rsync
for instance). Dockerfile
上下文(和ADD
)相当方便也不适应:我没有要发送的特定目录,而是使用工具组合来仅更改特定文件(例如,考虑rsync
) 。 ADD
contains some sort of algorithm that only adds new files to the image appropriately, I still have to send all files as docker context for the build command !. ADD
包含某种只适当地向图像添加新文件的算法,我仍然必须将所有文件作为docker context发送给build命令! apt-get install git
on a debian
image doubles the size of the image. debian
图像上的apt-get install git
会使图像的大小翻倍。 And git won't be used in production. -v
docker build's option to mount a directory full of tools... and their dependencies. -v
docker build选项来安装一个充满工具的目录......以及它们的依赖项。 This feels hard if you need more than a very simple bash-script. 在你的情况下,我会运行一个容器(我知道你反对这个)然后,例如rsync文件到/ var / lib / docker / devicemapper / mnt / CONTAINERID / rootfs,然后是docker commit。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.