[root@VM-0-10-centos /]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest feb5d9fea6a5 2 months ago 13.3kB
解释:
参数
解释
REPOSITORY
镜像的仓库源
TAG
镜像的标签
IMAGE ID
镜像的ID
CREATED
镜像的创建时间
SIZE
镜像的大小
可选项:
参数
解释
-a ,–all
列出所有镜像
-q,–quiet
只显示镜像的id
2、docker search — 搜索镜像
[root@VM-0-10-centos /]# docker search mysql
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 11722 [OK]
mariadb MariaDB Server is a high performing open sou… 4471 [OK]...
可选项,通过搜藏来过滤
--filter=STARS=3000 # 搜索出来的镜像就是STARS大于3000的
[root@VM-0-10-centos /]# docker search mysql --filter=STARS=3000
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… 11722 [OK]
mariadb MariaDB Server is a high performing open sou… 4471 [OK]
# 查看所有镜像[root@VM-0-10-centos /]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 8b43c6af2ad0 7 days ago 448MB
mysql latest b05128b000dd 7 days ago 516MB
hello-world latest feb5d9fea6a5 2 months ago 13.3kB
# 启动并进入容器[root@VM-0-10-centos /]# docker run -it centos /bin/bash[root@02846c1c59a7 /]# ls # 查看容器内的centos,基础版本,很多命令不完善
bin etc lib lost+found mnt proc run srv tmp var
dev home lib64 media opt root sbin sys usr
# 从容器中退回主机 [root@02846c1c59a7 /]# exitexit[root@VM-0-10-centos /]# ls
bin data etc lib lost+found mnt proc run srv tmp var
boot dev home lib64 media opt root sbin sys usr
3、列出所有运行的容器 ---- docker ps 命令
# 列出当前正在运行的容器
-a # 列出当前正在运行的容器+带出历史运行过的容器[root@VM-0-10-centos /]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@VM-0-10-centos /]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
02846c1c59a7 centos "/bin/bash" 5 minutes ago Exited (0) 2 minutes ago mystifying_euclid
e9638e508e8c feb5d9fea6a5 "/hello" 21 hours ago Exited (0) 21 hours ago recursing_colden
-n=? # 显示最近创建的容器[root@VM-0-10-centos /]# docker ps -a -n=1
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
02846c1c59a7 centos "/bin/bash" 9 minutes ago Exited (0) 5 minutes ago mystifying_euclid
帮助命令:docker version # 显示docker的版本信息docker info # 显示docker的系统信息,包括镜像和容器的docker 命令 --help # 帮助命令帮助文档的地址:https://docs.docker.com/reference/镜像命令:docker images # 查看所有本地的主机上的镜像[root@VM-0-10-centos /]# docker imagesREPOSITORY TAG IM