列出本地主机上的镜像 docker images
[root@wls ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ubuntu latest 27941809078c 2 months ago 77.8MB
redis 6.0.16 5e9f874f2d50 8 months ago 112MB
rabbitmq 3.8-management 699038cb2b96 8 months ago 250MB
hello-world latest feb5d9fea6a5 11 months ago 13.3kB
nacos/nacos-server latest bdf60dc2ada3 13 months ago 1.05GB
mysql 8.0.23 cbe8815cbea8 16 months ago 546MB
nacos/nacos-server 1.1.4 ac34e13f83a8 2 years ago 718MB
mysql 5.7.22 6bb891430fb6 4 years ago 372MB
各个选项说明:
REPOSITORY:表示镜像的仓库源
TAG:镜像的标签版本号
IMAGE ID:镜像ID
CREATED:镜像创建时间
SIZE:镜像大小
同一仓库源可以有多个 TAG版本,代表这个仓库源的不同个版本,我们使用 REPOSITORY:TAG 来定义不同的镜像。 如果你不指定一个镜像的版本标签,例如你只使用 ubuntu,docker 将默认使用 ubuntu:latest 镜像
搜索镜像docker search XX
[root@wls ~]# docker search redis
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
redis Redis is an open source key-value store that… 11283 [OK]
bitnami/redis Bitnami Redis Docker Image 229 [OK]
bitnami/redis-sentinel Bitnami Docker Image for Redis Sentinel 39 [OK]
bitnami/redis-cluster 34
rapidfort/redis RapidFort optimized, hardened image for Redi… 15
rapidfort/redis-cluster RapidFort optimized, hardened image for Redi… 15
circleci/redis CircleCI images for Redis 14 [OK]
docker search [OPTIONS] XX OPTIONS说明:--limit : 只列出N个镜像,默认25个
[root@wls ~]# docker search redis --limit 5
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
redis Redis is an open source key-value store that… 11283 [OK]
bitnami/redis Bitnami Redis Docker Image 229 [OK]
circleci/redis CircleCI images for Redis 14 [OK]
redis/redis-stack redis-stack installs a Redis server with add… 12
redis/redis-stack-server redis-stack-server installs a Redis server w… 9
也可以通过网站搜索hub.docker.com
下载镜像 docker pull XX
指定版本号:docker pull xx[:TAG]
没有TAG就是最新版:docker pull XX 等价 docker pull XX:latest
删除镜像 docker rmi 镜像ID
删除单个:docker rmi -f 镜像ID
删除多个:docker rmi -f 镜像名1:TAG 镜像名2:TAG
查看镜像/容器/数据卷所占的空间
[root@wls ~]# docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 5 3 1.997GB 622MB (31%)
Containers 6 2 4.154MB 4.154MB (99%)
Local Volumes 1 0 93B 93B (100%)
Build Cache 0 0 0B 0B