简体   繁体   English

码头工人我可以从另一个容器挂载操作系统吗

[英]docker can I mount os from another container

I have been setting up a runtime with several images. 我一直在设置带有多个图像的运行时。 I have been keeping them lean with one process and minimal os, based on debian (because I'm used to that). 我一直在使用基于debian的进程和最少的操作系统来保持精简(因为我已经习惯了)。

However, I wonder why I need all these copies of the OS? 但是,我想知道为什么我需要所有这些操作系统副本吗? Could I build one image with OS (to separate from host os) and then have other images mount relevant parts (read-only or copy where necessary -- /etc/ ...)? 我可以使用操作系统构建一个映像(与主机操作系统分开),然后让其他映像安装相关部分(只读或在必要时进行复制-/ etc / ...)吗?

I tried googling for this pattern but didn't find it. 我尝试使用谷歌搜索此模式,但没有找到它。 Are there any pitfalls? 有陷阱吗? Does docker need "something" present to be able to boot an image even before mounting? 码头工人是否需要提供“东西”才能在安装之前启动映像?

As long as you're using FROM debian as the base of each of your images, you only have one copy of debian . 只要您使用FROM debian作为每个图像的基础,就只有一个debian副本。 That's the beauty of using a copy-on-write filesystem like AUFS or btrfs. 这就是使用像AUFS或btrfs这样的写时复制文件系统的美妙之处。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM