1.获取镜像
docker search centos:7.8.2003
#默认是latest
2.查看镜像
docker images
docker images centos
3.删除镜像
docker pull hello-world
docker rmi hello-world
docker ps -a
#查看容器运行记录
docker rm 4834b16881b8
#如果有就先删除记录
docker rmi $(docker images -aq)
#docker rmi `docker images -aq`
#批量删除镜像
docker rm $(docker ps -aq)
#docker rm `docker ps -aq`
#批量删除容器
4.导出镜像
[root@localhost ~]# docker save centos > /opt/centos.tgz
[root@localhost ~]# cd /opt/
[root@localhost opt]# ls
centos.tgz containerd
[root@localhost opt]#
5.导入镜像
[root@localhost opt]# docker load -i centos.tgz
74ddd0ec08fa: Loading layer [==================================================>] 238.6MB/238.6MB
Loaded image: centos:latest
[root@localhost opt]#
[root@localhost opt]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 5d0da3dc9764 20 months ago 231MB
[root@localhost opt]# docker image inspect 5d0
#查看镜像信息