美文网首页
6.Docker镜像加载原理

6.Docker镜像加载原理

作者: _FireFly_ | 来源:发表于2023-11-18 00:42 被阅读0次

UnionFS(联合文件系统)

联合文件系统

解释:当mysql和tomcat都需要centos系统时候,下载mysql时候下载了centos系统,再下载tomcat的时候,系统就不需要再下载centos了 之前下载的centos可以共用


解释

Docker镜像加载原理

Docker镜像加载原理

解释:第一次只有debian内核 第二次debian内核又加了一层emocs 第三次 debian内核和emocs基础上又加了epache


层级解释

分层理解

1分层理解 会以 json 格式得到 docker 镜像中redis的元数据
docker image inspect redis:latest       #会以 json 格式得到 docker 镜像中redis的元数据
[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的元数据
docker image inspect redis:latest       #会以 json 格式得到 docker 镜像中redis的元数据
[
    {
        "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"
        }
    }
]

相关文章

网友评论

      本文标题:6.Docker镜像加载原理

      本文链接:https://www.haomeiwen.com/subject/fjmuwdtx.html