版本信息
docker version #版本信息
docker info #
docker 命令 --help
帮助文档https://docs.docker.com/reference/
查看本机所有镜像
docker images
[root@iZbp1d0213clo5fn6z0fsfZ ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
jenkins/jenkins latest ce038d88aadd 4 weeks ago 580MB
mysql 8 0627ec6901db 5 weeks ago 556MB
hello-world latest d1165f221234 2 months ago 13.3kB
#解释
REPOSITORY 镜像的仓库源
TAG 镜像的标签
IMAGE ID 镜像的id
CREATED 镜像的创建时间
SIZE 镜像的大小
# 可选项
-a , --all # 列出所有的镜像
-q, --quiet # 只显示镜像的id
搜索命令
docker search
[root@iZbp1d0213clo5fn6z0fsfZ ~]# docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 10932 [OK]
mariadb MariaDB Server is a high performing open sou… 4134 [OK]
# 可选项 通过搜索来过滤
--fliter=STARS=3000 #搜索出来的STARS是3000以上的
下载镜像
docker pull 镜像名 [:tag]版本
docker pull 镜像名 [:tag]版本
[root@iZbp1d0213clo5fn6z0fsfZ ~]# docker pull mysql
Using default tag: latest # 如果不写 tag. 默认就是 latest
latest: Pulling from library/mysql
69692152171a: Pull complete # 分层下载, docker iamge的核心 联合文件系统
1651b0be3df3: Pull complete
951da7386bc8: Pull complete
0f86c95aa242: Pull complete
37ba2d8bd4fe: Pull complete
6d278bb05e94: Pull complete
497efbd93a3e: Pull complete
f7fddf10c2c2: Pull complete
16415d159dfb: Pull complete
0e530ffc6b73: Pull complete
b0a4a1a77178: Pull complete
cd90f92aa9ef: Pull complete
Digest: sha256:d50098d7fcb25b1fcb24e2d3247cae3fc55815d64fec640dc395840f8fa80969 # 签名
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest # 真是地址
#等价于
docker pull mysql
docker pull docker.io/library/mysql:latest
删除镜像
docker rmi -f 镜像id
# 删除镜像
docker rmi -f 根据id删除
# 批量删除 所有容器
docker rmi -f $(docker images -aq) # 通过查出id批量删除