Does docker reuse images when multiple containers run on the same host?

不羁的心 提交于 2019-12-05 10:43:41

Dockers Understand images, containers, and storage drivers details most of this.

From Docker 1.10 onwards, all the layers that make up an image have an SHA256 secure content hash associated with them at build time. This hash is consistent across hosts and builds, as long as the content of the layer is the same.

If any number of images share a layer, only the 1 copy of that layer will be stored and used by all images on that instance of the Docker engine.

A tag like debian can refer to multiple SHA256 image hash's over time as new releases come out. Two images that are built with FROM debian don't necessarily share layers, only if the SHA256 hash's match.

Anything that runs the Docker Engine underneath will use this storage setup.

This sharing also works in the Docker Registry (>2.2 for the best results). If you were to push images with layers that already exist on that registry, the existing layers are skipped. Same with pulling layers to your local engine.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!