如何理解data-packedvolumecontainer

本篇文章為大家展示了data-packed volume container ,內(nèi)容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。

成都創(chuàng)新互聯(lián)公司專注于無為企業(yè)網(wǎng)站建設(shè),成都響應(yīng)式網(wǎng)站建設(shè)公司,商城網(wǎng)站開發(fā)。無為網(wǎng)站建設(shè)公司,為無為等地區(qū)提供建站服務(wù)。全流程按需搭建網(wǎng)站,專業(yè)設(shè)計,全程項目跟蹤,成都創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)

volume container 的數(shù)據(jù)歸根到底還是在 host 里,有沒有辦法將數(shù)據(jù)完全放到 volume container 中,同時又能與其他容器共享呢?

當然可以,通常我們稱這種容器為 data-packed volume container。其原理是將數(shù)據(jù)打包到鏡像中,然后通過 docker managed volume 共享。

我們用下面的 Dockerfile 構(gòu)建鏡像:

如何理解data-packed volume container

ADD 將靜態(tài)文件添加到容器目錄 /usr/local/apache2/htdocs。
VOLUME 的作用與 -v 等效,用來創(chuàng)建 docker managed volume,mount point 為 /usr/local/apache2/htdocs,因為這個目錄就是 ADD 添加的目錄,所以會將已有數(shù)據(jù)拷貝到 volume 中。 

build 新鏡像 datapacked:

如何理解data-packed volume container

因為在 Dockerfile 中已經(jīng)使用了 VOLUME 指令,這里就不需要指定 volume 的 mount point 了。啟動 httpd 容器并使用 data-packed volume container

容器能夠正確讀取 volume 中的數(shù)據(jù)。data-packed volume container 是自包含的,不依賴 host 提供數(shù)據(jù),具有很強的移植性,非常適合 只使用 靜態(tài)數(shù)據(jù)的場景,比如應(yīng)用的配置信息、web server 的靜態(tài)文件等。

上述內(nèi)容就是data-packed volume container ,你們學(xué)到知識或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識儲備,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

當前題目:如何理解data-packedvolumecontainer
分享地址:http://bm7419.com/article28/geehcp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供建站公司、品牌網(wǎng)站制作、網(wǎng)站設(shè)計、網(wǎng)站設(shè)計公司、網(wǎng)站維護、用戶體驗

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

小程序開發(fā)