docker日常管理

 

 

1.删除镜像
docker images
docker rmi bf756fb1ae65 ##镜像id

 

2.停掉docker容器
docker ps -a
docker stop f8397131982c

 

3.删除容器

docker ps -a
docker rm 1a18447e378b

或者是直接找出后删除
docker rm -f `docker ps -a -q`

 

4.docker重启某个镜像
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e18cf4366179 percona/pmm-server:2 "/opt/entrypoint.sh" 3 hours ago Exited (0) 5 minutes ago pmm-server
cb94c09505a3 percona/pmm-server:2 "/bin/true" 3 hours ago Created pmm-data
[root@localhost ~]# docker restart e18cf4366179

 

5.登录容器
[root@localhost ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e18cf4366179 percona/pmm-server:2 "/opt/entrypoint.sh" 3 hours ago Up 10 minutes (healthy) 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp pmm-server

[root@localhost ~]#docker exec -ti pmm-server /bin/bash

 

 6.查看停掉的容器

docker ps -a --filter "status=exited" -q

 

 

 

7.拉取镜像
docker pull registry.cn-shenzhen.aliyuncs.com/gondor/milvus:v2.4.6
docker pull registry.cn-shenzhen.aliyuncs.com/gondor/attu:v2.4.6

 

 

8.保存镜像到本地

[root@host134 2.4.6]# docker images
REPOSITORY                                        TAG                            IMAGE ID       CREATED         SIZE
registry.cn-shenzhen.aliyuncs.com/gondor/attu     v2.4.6                         3d15903f4290   7 days ago      293MB
registry.cn-shenzhen.aliyuncs.com/gondor/milvus   v2.4.6                         636269526977   3 weeks ago     1.79GB
milvusdb/milvus                                   v2.3.5                         49ec7be59e9e   6 months ago    968MB
zilliz/attu                                       v2.3.6                         3905dd95d828   7 months ago    282MB
minio/minio                                       RELEASE.2023-03-20T20-16-18Z   400c20c8aac0   16 months ago   252MB
quay.io/coreos/etcd                               v3.5.5                         673f29d03de9   23 months ago   182MB

 

docker save -o /soft/milvus/2.4.6/milvus2.4.6.tar.gz 636269526977
docker save -o /soft/milvus/2.4.6/attu2.4.6.tar.gz 3d15903f4290

 

9.删除镜像

docker rmi $(docker images -q)

 

10.查看latest镜像的版本

docker image inspect registry.cn-shenzhen.aliyuncs.com/gondor/postgres:latest|grep -i version

 

11.加载镜像

docker load -i milvus2.4.6.tar.gz

 

12.多个tag的镜像删除其中一个

[root@master soft]# docker images
REPOSITORY                                                 TAG        IMAGE ID       CREATED         SIZE
registry.cn-shenzhen.aliyuncs.com/hxlk8s/milvus-operator   v1.1.2     57e7ab5dd7b8   12 days ago     179MB
k8s.gcr.io/kube-apiserver                                  v1.28.13   5447bb21fa28   3 months ago    125MB
k8s.gcr.io/kube-scheduler                                  v1.28.13   a60f64c0f37d   3 months ago    59.3MB
k8s.gcr.io/kube-controller-manager                         v1.28.13   f1a0a396058d   3 months ago    121MB
k8s.gcr.io/kube-proxy                                      v1.28.13   31fde28e72a3   3 months ago    81.8MB
k8s.gcr.io/etcd                                            3.5.9-0    73deb9a3f702   18 months ago   294MB
k8s.gcr.io/coredns                                         v1.10.1    ead0a4a53df8   21 months ago   53.6MB
k8s.gcr.io/pause                                           3.9        e6f181688397   2 years ago     744kB

docker rmi registry.cn-shenzhen.aliyuncs.com/hxlk8s/milvus-operator:v1.1.2

 

posted @ 2023-06-15 14:47  slnngk  阅读(22)  评论(0编辑  收藏  举报