docker容器镜像的保存位置
使用命令,可以发现默认的根目录是。
·
查看docker镜像的保存目录
使用命令 docker info | grep "Docker Root Dir"
,可以发现默认的根目录是/var/lib/docker
[root@k8s-master ~]# docker info | grep "Docker Root Dir"
WARNING: You're not using the default seccomp profile
WARNING: IPv4 forwarding is disabled
Docker Root Dir: /var/lib/docker
[root@k8s-master ~]#
查看容器使用的镜像位置
使用命令docker insepct <name>
,查看GraphDriver
字段,发现镜像位置在/var/lib/docker/overlay2
[root@k8s-master ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
503793d093e2 docker.io/redis:latest "docker-entrypoint..." 14 months ago Up 44 seconds 0.0.0.0:6379->6379/tcp redis
[root@k8s-master ~]#
[root@k8s-master ~]#
[root@k8s-master ~]# docker inspect 50 | jq .[0]."GraphDriver"
{
"Name": "overlay2",
"Data": {
"LowerDir": "/var/lib/docker/overlay2/f86daaea7cd166672a7b6fd03454d20d1bd263b3ed1d6a9b1a63453474bc394b-init/diff:/var/lib/docker/overlay2/cc2d0f782e8cd77dac73b0a8e98db0ac0a9d3cf51d33b37e0d25ea524d19e592/diff:/var/lib/docker/overlay2/fda077c50a0a7ae718ff9ec43ebcc46e06ca3b1d5d29314c5052d0d273f6a066/diff:/var/lib/docker/overlay2/c045676a24afecd5f16c6adcdefb5ee6f39e4fcbfc29cd59070ff5101715a9cb/diff:/var/lib/docker/overlay2/60956264b48bea4615baeb1a475c986a812384833ca77e628c78ad04c3081544/diff:/var/lib/docker/overlay2/5d157d02fa408326164bdcbdb79043a153949bfe6e8d0855c42f6175c18ee554/diff:/var/lib/docker/overlay2/615d8ec38f63cdea2fb283cdb02facb962f7d0ede983b7bd9eb612d7576cf690/diff",
"MergedDir": "/var/lib/docker/overlay2/f86daaea7cd166672a7b6fd03454d20d1bd263b3ed1d6a9b1a63453474bc394b/merged",
"UpperDir": "/var/lib/docker/overlay2/f86daaea7cd166672a7b6fd03454d20d1bd263b3ed1d6a9b1a63453474bc394b/diff",
"WorkDir": "/var/lib/docker/overlay2/f86daaea7cd166672a7b6fd03454d20d1bd263b3ed1d6a9b1a63453474bc394b/work"
}
}
[root@k8s-master ~]#
查看镜像列表
1、docker images
[root@k8s-master ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/mysql latest 562c9bc24a08 15 months ago 521 MB
docker.io/redis latest 87c26977fd90 15 months ago 113 MB
gorestful nocmd 1d52d9037493 22 months ago 12.2 MB
gorestful v1.1 a8bc12a7d372 22 months ago 12.2 MB
gorestful v1 c7cfe51cbb6a 22 months ago 12.3 MB
docker.io/alpine latest 021b3423115f 22 months ago 5.6 MB
registry.aliyuncs.com/google_containers/kube-apiserver v1.21.2 106ff58d4308 24 months ago 126 MB
registry.aliyuncs.com/google_containers/kube-controller-manager v1.21.2 ae24db9aa2cc 24 months ago 120 MB
registry.aliyuncs.com/google_containers/kube-proxy v1.21.2 a6ebd1c1ad98 24 months ago 131 MB
registry.aliyuncs.com/google_containers/kube-scheduler v1.21.2 f917b8c8f55b 24 months ago 50.6 MB
docker.io/kong/kubernetes-ingress-controller latest dc5696e34b98 2 years ago 80.3 MB
quay.io/coreos/flannel v0.14.0 8522d622299c 2 years ago 67.9 MB
registry.aliyuncs.com/google_containers/pause 3.4.1 0f8457a4c2ec 2 years ago 683 kB
docker.io/coredns/coredns 1.8.0 296a6d5035e2 2 years ago 42.5 MB
registry.aliyuncs.com/google_containers/coredns/coredns v1.8.0 296a6d5035e2 2 years ago 42.5 MB
registry.aliyuncs.com/google_containers/coredns v1.8.0 296a6d5035e2 2 years ago 42.5 MB
registry.cn-hangzhou.aliyuncs.com/google_containers/coredns/coredns v1.8.0 296a6d5035e2 2 years ago 42.5 MB
registry.aliyuncs.com/google_containers/etcd 3.4.13-0 0369cf4303ff 2 years ago 253 MB
registry.cn-hangzhou.aliyuncs.com/yilong/ingress-test web1 dd59ebb7e0d6 2 years ago 211 MB
[root@k8s-master ~]#
2、cat /var/lib/docker/image/overlay2/repositories.json
对应docker images
查到的镜像
[root@k8s-master ~]# cat /var/lib/docker/image/overlay2/repositories.json | jq .
{
"Repositories": {
"docker.io/alpine": {
"docker.io/alpine:latest": "sha256:021b3423115ff662225e83d7e2606475217de7b55fde83ce3447a54019a77aa2",
"docker.io/alpine@sha256:eb3e4e175ba6d212ba1d6e04fc0782916c08e1c9d7b45892e9796141b1d379ae": "sha256:021b3423115ff662225e83d7e2606475217de7b55fde83ce3447a54019a77aa2"
},
"docker.io/coredns/coredns": {
"docker.io/coredns/coredns:1.8.0": "sha256:296a6d5035e2d6919249e02709a488d680ddca91357602bd65e605eac967b899",
"docker.io/coredns/coredns@sha256:cc8fb77bc2a0541949d1d9320a641b82fd392b0d3d8145469ca4709ae769980e": "sha256:296a6d5035e2d6919249e02709a488d680ddca91357602bd65e605eac967b899"
},
"docker.io/kong/kubernetes-ingress-controller": {
"docker.io/kong/kubernetes-ingress-controller:latest": "sha256:dc5696e34b98b3e7c43d49a233824598358fe86292617fcd95c85781de8bd89e",
"docker.io/kong/kubernetes-ingress-controller@sha256:6d7e1f96c7bbe1d52bc0369b7042ab0fa1cd2ff80792ba2e94c04a5dbe50838a": "sha256:dc5696e34b98b3e7c43d49a233824598358fe86292617fcd95c85781de8bd89e"
},
"docker.io/mysql": {
"docker.io/mysql:latest": "sha256:562c9bc24a0883226e994aabbd09fcb5621a4eadb510df749bc6dac40fa991e3",
"docker.io/mysql@sha256:b2ae0f527005d99bacdf3a220958ed171e1eb0676377174f0323e0a10912408a": "sha256:562c9bc24a0883226e994aabbd09fcb5621a4eadb510df749bc6dac40fa991e3"
},
...(等等)
更多推荐
已为社区贡献2条内容
所有评论(0)