Docker-v17 的層級(layer)概念


Docker 的層級(layer)概念
1.鏡像(images)與層級(layers):
Docker 鏡像是由多個文件系統(只讀層)疊加而成, 每個層僅包含了前一層的差異部分當我們啟動一個容器的時候,Docker 會加載鏡像層並在其上添加一個可寫層。容器上所做的任何更改,譬如新建文件、更改文件、刪除文件,都將記錄與可寫層上。容器層與鏡像層的結構如下圖所示。
(A Docker image is built up from a series of layers. Each layer is only a set of differences from the layer before it. The layers are stacked on top of each other. When you create a new container, you add a new writable layer on top of the underlying layers. This layer is often called the “container layer”. All changes made to the running container, such as writing new files, modifying existing files, and deleting files, are written to this thin writable container layer. The diagram below shows a container based on the Ubuntu 15.04 image.)

 

2.容器(container)與層級(layers):
容器與鏡像最大的區別就在於可寫層上。如果運行中的容器修改了現有的一個已存在的文件,那該文件將會從可寫層下的只讀層復制到可寫層,該文件的只讀版本仍然存在,只是已經被可寫層中該文件的副本所隱藏。其中,多個容器共享鏡像的結構如下所示。
(The major difference between a container and an image is the top writable layer. All writes to the container that add new or modify existing data are stored in this writable layer. When the container is deleted, the writable layer is also deleted. The underlying image remains unchanged.
Because each container has its own writable container layer, and all changes are stored in this container layer, multiple containers can share access to the same underlying image and yet have their own data state. The diagram below shows multiple containers sharing the same Ubuntu 15.04 image.)
 

 

 
參考資料:
(1).https://docs.docker.com/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM