Docker的常用命令

帮助文档地址 Use the Docker command line | Docker Documentation

帮助命令

docker version      //显示docker的基本信息
docker into         //显示docker的系统信息,包括镜像和容器的数量
docker 命令--help    //帮助命令

镜像命令

docker images 查看所有本地的主机上的镜像

[root@LiShengRui ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
hello-world   latest    feb5d9fea6a5   7 weeks ago   13.3kB
centos        latest    5d0da3dc9764   8 weeks ago   231MB
//解释
REPOSITORY  镜像的仓库源
TAG         镜像的标签
IMAGE ID    镜像的id
CREATED     镜像的创建时间  
SIZE        镜像的大小

#docker images     -a, --all   //显示所有镜像Show all images (default hides intermediate images)
                   -q, --quiet //只显示镜像的ID //Only show image IDs
                   --digests         Show digests过滤器,-f根据提供的条件过滤输出
                   -f, --filter filter   Filter output based on conditions provided
                   --format string   Pretty-print images using a Go template
                   --no-trunc        Don't truncate output

docker search 搜索镜像

[root@LiShengRui ~]# docker search mysql
NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
mysql                             MySQL is a widely used, open-source relation…   11680     [OK]       
mariadb                           MariaDB Server is a high performing open sou…   4450      [OK]     

//可选项,通过收藏数量stars过滤 
-f, --filter filter   Filter output based on conditions provided
                          根据提供的条件过滤输出
   
  #docker search mysql --filter=STARS=4000
  //查询收藏大于4000的MySQL版本

docker pull 下载镜像

//docker pull 镜像名[:tag版本号] 不加版本号默认下载最新版  
[root@LiShengRui ~]# docker pull mysql
Using default tag: latest    //不写tag 默认latest最新版
latest: Pulling from library/mysql
b380bbd43752: Pull complete  //分层下载 docker image的核心  联合文件系统
f23cbf2ecc5d: Pull complete 
30cfc6c29c0a: Pull complete 
b38609286cbe: Pull complete 
8211d9e66cd6: Pull complete 
2313f9eeca4a: Pull complete 
7eb487d00da0: Pull complete 
4d7421c8152e: Pull complete 
77f3d8811a28: Pull complete 
cce755338cba: Pull complete 
69b753046b9f: Pull complete 
b2e64b0ab53c: Pull complete 
Digest: sha256:6d7d4524463fe6e2b893ffc2b89543c81dec7ef82fb2020a1b27606666464d87
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest  //真实地址(docker pull mysql等价于docker pull docker.io/library/mysql:latest)


指定版本下载
docker pull mysql:5.7


docker rmi 删除镜像

docker rmi -f 镜像id              //删除指定镜像
docker rmi -f 镜像id 镜像id 镜像id //删除多个镜像
docker rmi -f $(docker images -aq)//删除全部镜像

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值