6.Docker鏡像加載原理

UnionFS(聯(lián)合文件系統(tǒng))

聯(lián)合文件系統(tǒng)

解釋:當mysql和tomcat都需要centos系統(tǒng)時候铅忿,下載mysql時候下載了centos系統(tǒng)精刷,再下載tomcat的時候拗胜,系統(tǒng)就不需要再下載centos了 之前下載的centos可以共用


解釋

Docker鏡像加載原理

Docker鏡像加載原理

解釋:第一次只有debian內(nèi)核 第二次debian內(nèi)核又加了一層emocs 第三次 debian內(nèi)核和emocs基礎上又加了epache


層級解釋

分層理解

1分層理解
會以 json 格式得到 docker 鏡像中redis的元數(shù)據(jù)
docker image inspect redis:latest       #會以 json 格式得到 docker 鏡像中redis的元數(shù)據(jù)
[root@localhost ~]# docker image inspect redis:latest
[
    {
        "Id": "sha256:e10bd12f0b2d6a1ff41c9555ebb2c65056ae612bc074f5f46ebf36e5445346cd",
        "RepoTags": [
            "redis:latest"
        ],
        "RepoDigests": [
            "redis@sha256:529d1db9e246240208eab2a61fbb8614b09d7505ac1329c1dec70b6aba2e1428"
        ],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2023-11-10T15:23:15Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "6379/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.16",
                "REDIS_VERSION=7.2.3",
                "REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-7.2.3.tar.gz",
                "REDIS_DOWNLOAD_SHA=3e2b196d6eb4ddb9e743088bfc2915ccbb42d40f5a8a3edd8cb69c716ec34be7"
            ],
            "Cmd": [
                "redis-server"
            ],
            "ArgsEscaped": true,
            "Image": "",
            "Volumes": {
                "/data": {}
            },
            "WorkingDir": "/data",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 137766170,
        "VirtualSize": 137766170,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/72803f7e7eeecc08c776d5916af1e739675f9eab7906b14f05fb9d1c78fb8616/diff:/var/lib/docker/overlay2/de4fdf42ed05b44de681a1c98b015fa74714f51d3ece2905c316d481cfcc1627/diff:/var/lib/docker/overlay2/2ccbf20393f59984efef7528596373bb9ffa297c87c321fd9e5bd681de6fa7a0/diff:/var/lib/docker/overlay2/f481e84f7053c2032fb6d64ac7d3a000941ac4c3e61f5754c1489c94920629e4/diff:/var/lib/docker/overlay2/a98598ebb8990c2f5621630d23315442a2d1c39630e859b8505ae4b389b85d82/diff:/var/lib/docker/overlay2/26d6f985e72975fdff2c8e2eb1b95c49348b941dd0be7998bce8754e09e26d8d/diff",
                "MergedDir": "/var/lib/docker/overlay2/3fffe0a185cb41d5dcf04881ada01fa638229bfbce53b69b6a58ebcc05f886ac/merged",
                "UpperDir": "/var/lib/docker/overlay2/3fffe0a185cb41d5dcf04881ada01fa638229bfbce53b69b6a58ebcc05f886ac/diff",
                "WorkDir": "/var/lib/docker/overlay2/3fffe0a185cb41d5dcf04881ada01fa638229bfbce53b69b6a58ebcc05f886ac/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:ec983b16636050e69677eb81537e955ab927757c23aaf73971ecf5f71fcc262a",
                "sha256:61f649858ac5ab58cbd8e170307daa3ef1e23e7d9e8379b819b773bf578770ea",
                "sha256:6757730e0d05b9584eae5f1238bc694e70301adbc20ae4ea281249a7be25d867",
                "sha256:b4484867fe8aecc60288bd40ba966bc673cda4fe86ec51ccde6b33a8502b8249",
                "sha256:60af4bba8555216fdbaf3a24d90b892854c2efdbe706a1005b696e201aaa79b2",
                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
                "sha256:45b447397f50d65a1a93eb3121fb50e1a867b33ce2c807c0faebbbe4a38b6b8e"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]
2分層理解
3分層理解
4分層理解
5分層理解
6分層理解
會以 json 格式得到 docker 鏡像中redis的元數(shù)據(jù)
docker image inspect redis:latest       #會以 json 格式得到 docker 鏡像中redis的元數(shù)據(jù)
[
    {
        "Id": "sha256:e10bd12f0b2d6a1ff41c9555ebb2c65056ae612bc074f5f46ebf36e5445346cd",
        "RepoTags": [
            "redis:latest"
        ],
        "RepoDigests": [
            "redis@sha256:529d1db9e246240208eab2a61fbb8614b09d7505ac1329c1dec70b6aba2e1428"
        ],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2023-11-10T15:23:15Z",
        "Container": "",
        "ContainerConfig": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": null,
            "Cmd": null,
            "Image": "",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "6379/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.16",
                "REDIS_VERSION=7.2.3",
                "REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-7.2.3.tar.gz",
                "REDIS_DOWNLOAD_SHA=3e2b196d6eb4ddb9e743088bfc2915ccbb42d40f5a8a3edd8cb69c716ec34be7"
            ],
            "Cmd": [
                "redis-server"
            ],
            "ArgsEscaped": true,
            "Image": "",
            "Volumes": {
                "/data": {}
            },
            "WorkingDir": "/data",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 137766170,
        "VirtualSize": 137766170,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/72803f7e7eeecc08c776d5916af1e739675f9eab7906b14f05fb9d1c78fb8616/diff:/var/lib/docker/overlay2/de4fdf42ed05b44de681a1c98b015fa74714f51d3ece2905c316d481cfcc1627/diff:/var/lib/docker/overlay2/2ccbf20393f59984efef7528596373bb9ffa297c87c321fd9e5bd681de6fa7a0/diff:/var/lib/docker/overlay2/f481e84f7053c2032fb6d64ac7d3a000941ac4c3e61f5754c1489c94920629e4/diff:/var/lib/docker/overlay2/a98598ebb8990c2f5621630d23315442a2d1c39630e859b8505ae4b389b85d82/diff:/var/lib/docker/overlay2/26d6f985e72975fdff2c8e2eb1b95c49348b941dd0be7998bce8754e09e26d8d/diff",
                "MergedDir": "/var/lib/docker/overlay2/3fffe0a185cb41d5dcf04881ada01fa638229bfbce53b69b6a58ebcc05f886ac/merged",
                "UpperDir": "/var/lib/docker/overlay2/3fffe0a185cb41d5dcf04881ada01fa638229bfbce53b69b6a58ebcc05f886ac/diff",
                "WorkDir": "/var/lib/docker/overlay2/3fffe0a185cb41d5dcf04881ada01fa638229bfbce53b69b6a58ebcc05f886ac/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:ec983b16636050e69677eb81537e955ab927757c23aaf73971ecf5f71fcc262a",
                "sha256:61f649858ac5ab58cbd8e170307daa3ef1e23e7d9e8379b819b773bf578770ea",
                "sha256:6757730e0d05b9584eae5f1238bc694e70301adbc20ae4ea281249a7be25d867",
                "sha256:b4484867fe8aecc60288bd40ba966bc673cda4fe86ec51ccde6b33a8502b8249",
                "sha256:60af4bba8555216fdbaf3a24d90b892854c2efdbe706a1005b696e201aaa79b2",
                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
                "sha256:45b447397f50d65a1a93eb3121fb50e1a867b33ce2c807c0faebbbe4a38b6b8e"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市贬养,隨后出現(xiàn)的幾起案子挤土,更是在濱河造成了極大的恐慌,老刑警劉巖误算,帶你破解...
    沈念sama閱讀 206,378評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件仰美,死亡現(xiàn)場離奇詭異,居然都是意外死亡儿礼,警方通過查閱死者的電腦和手機咖杂,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,356評論 2 382
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來蚊夫,“玉大人诉字,你說我怎么就攤上這事。” “怎么了壤圃?”我有些...
    開封第一講書人閱讀 152,702評論 0 342
  • 文/不壞的土叔 我叫張陵陵霉,是天一觀的道長。 經(jīng)常有香客問我伍绳,道長踊挠,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 55,259評論 1 279
  • 正文 為了忘掉前任冲杀,我火速辦了婚禮效床,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘权谁。我一直安慰自己剩檀,他們只是感情好,可當我...
    茶點故事閱讀 64,263評論 5 371
  • 文/花漫 我一把揭開白布旺芽。 她就那樣靜靜地躺著沪猴,像睡著了一般。 火紅的嫁衣襯著肌膚如雪甥绿。 梳的紋絲不亂的頭發(fā)上字币,一...
    開封第一講書人閱讀 49,036評論 1 285
  • 那天,我揣著相機與錄音共缕,去河邊找鬼洗出。 笑死,一個胖子當著我的面吹牛图谷,可吹牛的內(nèi)容都是我干的翩活。 我是一名探鬼主播,決...
    沈念sama閱讀 38,349評論 3 400
  • 文/蒼蘭香墨 我猛地睜開眼便贵,長吁一口氣:“原來是場噩夢啊……” “哼菠镇!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起承璃,我...
    開封第一講書人閱讀 36,979評論 0 259
  • 序言:老撾萬榮一對情侶失蹤利耍,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后盔粹,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體隘梨,經(jīng)...
    沈念sama閱讀 43,469評論 1 300
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 35,938評論 2 323
  • 正文 我和宋清朗相戀三年舷嗡,在試婚紗的時候發(fā)現(xiàn)自己被綠了轴猎。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,059評論 1 333
  • 序言:一個原本活蹦亂跳的男人離奇死亡进萄,死狀恐怖捻脖,靈堂內(nèi)的尸體忽然破棺而出锐峭,到底是詐尸還是另有隱情,我是刑警寧澤可婶,帶...
    沈念sama閱讀 33,703評論 4 323
  • 正文 年R本政府宣布沿癞,位于F島的核電站,受9級特大地震影響扰肌,放射性物質(zhì)發(fā)生泄漏抛寝。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 39,257評論 3 307
  • 文/蒙蒙 一曙旭、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧晶府,春花似錦桂躏、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,262評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至较沪,卻和暖如春鳞绕,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背尸曼。 一陣腳步聲響...
    開封第一講書人閱讀 31,485評論 1 262
  • 我被黑心中介騙來泰國打工们何, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留优构,地道東北人塘淑。 一個月前我還...
    沈念sama閱讀 45,501評論 2 354
  • 正文 我出身青樓些己,卻偏偏與公主長得像箕母,于是被迫代替她去往敵國和親恭垦。 傳聞我的和親對象是個殘疾皇子折晦,可洞房花燭夜當晚...
    茶點故事閱讀 42,792評論 2 345

推薦閱讀更多精彩內(nèi)容