一、列出本地主机上的镜像命令
1、列出本地主机上的镜像命令: docker images
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
rtdbinterface latest 5f30db405001 4 weeks ago 261MB
hello-world latest fce289e99eb9 6 months ago 1.84kB
[root@localhost ~]#
2、列出本地所有的镜像(含中间映像层)命令:docker images -a
[root@localhost ~]# docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
rtdbinterface latest 5f30db405001 4 weeks ago 261MB
hello-world latest fce289e99eb9 6 months ago 1.84kB
[root@localhost ~]#
3、列出本地所有的镜像,只显示镜像ID的命令:docker images -q
[root@localhost ~]# docker images -q
5f30db405001
fce289e99eb9
[root@localhost ~]#
4、列出本地所有的镜像,显示镜像的摘要信息的命令:docker images --digests
[root@localhost ~]# docker images --digests
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
rtdbinterface latest 5f30db405001 4 weeks ago 261MB
hello-world latest sha256:0e11c388b664df8a27a901dce21eb89f11d8292f7fca1b3e3c4321bf7897bffe fce289e99eb9 6 months ago 1.84kB
5、列出本地所有的镜像,显示完整的镜像信息的命令:docker images --no-trunc
[root@localhost ~]# docker images --no-trunc
REPOSITORY TAG IMAGE ID CREATED SIZE
rtdbinterface latest sha256:5f30db405001dda9e8908fec8e2741deafe72d81751a1ce1bce964e5a54169a5 4 weeks ago 261MB
hello-world latest sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e 6 months ago 1.84kB
二、查找镜像命令
1、查询某个镜像的命令:docker search 某个XXX镜像名字
[root@localhost ~]# docker search tomcat
2、列出收藏数不小于指定值的镜像命令:docker search -s 30 某个XXX镜像名字
[root@localhost ~]# docker search -s 30 tomcat
3、列出收藏数不小于指定值的镜像,并显示完整的镜像描述命令:docker search -s 30 --no-trunc 某个XXX镜像名字
[root@localhost ~]# docker search -s 30 --no-trunc tomcat
三、下载镜像命令
1、下载镜像命令:docker pull 某个XXX镜像名字
[root@localhost ~]# docker pull tomcat
四、删除镜像命令:
1、删除单个镜像的命令:docker rmi -f 镜像ID
[root@localhost ~]# docker rmi -f hello-world
2、删除多个镜像的命令 docker rmi -f 镜像名1:TAG 镜像名2:TAG
[root@localhost ~]# docker rmi -f hello-world nginx
3、删除全部镜像的命令:docker rmi -f $(docker images -qa)