Docker進階與實踐之三:Docker映象

百聯達發表於2019-05-18

一:思維導圖

Docker進階與實踐之三:Docker映象 Docker 映象.jpg

二:映象的生命週期


三:映象的組織結構

四:映象的資料結構

docker inspect busybox:latest

[
    {
        "Id": "sha256:8c811b4aec35f259572d0f79207bc0678df4c736eeec50bc9fec37ed936a472a",
        "RepoTags": [
            "docker.io/busybox:latest"
        ],
        "RepoDigests": [
            "docker.io/busybox@sha256:141c253bc4c3fd0a201d32dc1f493bcf3fff003b6df416dea4f41046e0f37d47"
        ],
        "Parent": "",
        "Comment": "",
        "Created": "2018-05-23T21:19:31.132152818Z",
        "Container": "617bfbb850a66642161d4925e0c00f77caa46e22057409788207e7b2edb86c3e",
        "ContainerConfig": {
            "Hostname": "617bfbb850a6",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "/bin/sh",
                "-c",
                "#(nop) ",
                "CMD [\"sh\"]"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:3e8a1c5213eb57c6ea8ddb27d86a241698741ce60d9053b641f57a7e455f6842",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": {}
        },
        "DockerVersion": "17.06.2-ce",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
            ],
            "Cmd": [
                "sh"
            ],
            "ArgsEscaped": true,
            "Image": "sha256:3e8a1c5213eb57c6ea8ddb27d86a241698741ce60d9053b641f57a7e455f6842",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": null,
            "OnBuild": null,
            "Labels": null
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 1146369,
        "VirtualSize": 1146369,
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "RootDir": "/var/lib/docker/overlay/4f7e0d9cff96526ac13d288d22e27be31f9fc8c7e5976aa3640a4ac2d0b2c7fb/root"
            }
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:432b65032b9466b4dadcc5c7b11701e71d21c18400aae946b101ad16be62333a"
            ]
        }
    }
]

a.Id: Image的ID實際上只是最上層的layerID

b.Parent: 該layer的父層,可以遞迴地獲得某個Image的所有layer資訊

c.Comment: 非常類似於Git的commit message

d.Container: 容器啟動需要以image為模板,但又可以把容器儲存為映象,所以一般來說image的每個layer都儲存自一個容器,所以該容器可以說是image layer的“模板”

e.Config 包含了該image的一些配置資訊

f.Architecture: 該image對應的CPU體系結構,現在Docker官方支援amd64 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28624388/viewspace-2644847/,如需轉載,請註明出處,否則將追究法律責任。

相關文章