如果我将10个都使用了来自Docker集线器的基本映像的应用dockerize:php:7.3-apache-stretch
(约378MB),它们将在我的主机中实质上占据3.8GB +(378MB基本映像x 10个不同应用)的磁盘空间机器?
编辑:我问的原因是因为如果键入docker image
,则会显示:
REPOSITORY TAG IMAGE ID CREATED SIZE
docker-test latest f941ae2a70f1 31 hours ago 378MB
<none> <none> 4c71598a1098 31 hours ago 378MB
<none> <none> 5255a13a71c7 32 hours ago 378MB
<none> <none> 4979b0dc765c 32 hours ago 378MB
<none> <none> 97c2190de3d5 32 hours ago 378MB
<none> <none> d2e33f282127 32 hours ago 378MB
<none> <none> e38ef642324e 32 hours ago 378MB
php 7.3-apache-stretch 1e9efd9f6779 7 days ago 378MB
答案 0 :(得分:1)
由于docker使用图层存储文件的方式,基本映像只会存储一次。最好在the documentation.
中对其详细说明在您的示例中,这10个应用程序将仅为您更改/添加到图像的所有文件的大小占用额外的空间。因此,如果每个应用程序均为5MB,则全部10个都将占用10 * 5MB + 378MB = 428MB
。 (number of apps) * (size of applications) + (base image size)
。
答案 1 :(得分:0)
不,只读层-构成您的基本映像的层以及从Dockerfile创建的层-将由所有正在运行的容器共享。
有关详细信息,请参见https://docs.docker.com/storage/storagedriver/#container-and-layers和https://docs.docker.com/storage/storagedriver/#container-size-on-disk。