UnionFS(聯(lián)合文件系統(tǒng))
解釋:當mysql和tomcat都需要centos系統(tǒng)時候铅忿,下載mysql時候下載了centos系統(tǒng)精刷,再下載tomcat的時候拗胜,系統(tǒng)就不需要再下載centos了 之前下載的centos可以共用
Docker鏡像加載原理
解釋:第一次只有debian內(nèi)核 第二次debian內(nèi)核又加了一層emocs 第三次 debian內(nèi)核和emocs基礎上又加了epache
分層理解
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"
}
}
]
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"
}
}
]