docker镜像基本命令

Docker常用命令

帮助命令

docker version  ##版本信息
docker info     ##系统信息,镜像、容器数量
docker 命令 help ##万能命令

帮助文档的地址:https://docs.docker.com/reference/

镜像命令

docker image
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
hello-world   latest    d1165f221234   6 weeks ago   13.3kB
​
##解释
REPOSITORY  镜像的仓库员
TAG         镜像标签
IMAGEID     镜像的ID
CREATED     镜像创建时间
SIZE        镜像大小容量
​
##可选项
Options:
  -a, --all             Show all images (default hides intermediate images)列出所有镜像
      --digests         Show digests/格式化
  -f, --filter filter   Filter output based on conditions provided
      --format string   Pretty-print images using a Go template
      --no-trunc        Don't truncate output
  -q, --quiet           Only show image IDs只显示镜像的ID
​

了解dockerhubhttps://hub.docker.com/

相当于应用商店

docker search mysql
NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
mysql                             MySQL is a widely used, open-source relation…   10777     [OK]       
mariadb                           MariaDB Server is a high performing open sou…   4058      [OK]       
​
##可选项
Options:
  -f, --filter filter   Filter output based on conditions provided通过搜素来过滤
      --format string   Pretty-print search using a Go template
      --limit int       Max number of search results (default 25)
      --no-trunc        Don't truncate output
例:
--filter=stars=3000 搜索出来大于3000的镜像
​
docker pull     下载镜像
[tag]    版本
Using default tag: latest               ##如果不知名tag则默认latest
latest: Pulling from library/mysql
f7ec5a41d630: Pull complete             ##分层下载docker镜像核心/联合文件系统
9444bb562699: Pull complete 
6a4207b96940: Pull complete 
181cefd361ce: Pull complete 
8a2090759d8a: Pull complete 
15f235e0d7ee: Pull complete 
d870539cd9db: Pull complete 
493aaa84617a: Pull complete 
bfc0e534fc78: Pull complete 
fae20d253f9d: Pull complete 
9350664305b3: Pull complete 
e47da95a5aab: Pull complete 
Digest: sha256:04ee7141256e83797ea4a84a4d31b1f1bc10111c8d1bc1879d52729ccd19e20a
##签名信息/防伪标志
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   //看有没有官方支持的版本
用过上面命令的同学会发现有问题
因为安装过上面的mysql之后发现分层竟然不需要全部下载
系统智能识别下载,发现有的共享文件被下载过了智能识别不一样的文件更新即可,大大节省流量及存储
​
​
​
##可选项
Options:
  -a, --all-tags                Download all tagged images in the repository
      --disable-content-trust   Skip image verification (default true)
      --platform string         Set platform if server is multi-platform capable
  -q, --quiet                   Suppress verbose output
​
docker rmi              //删除镜像rm+image
-f                      //全部删除
​
玩法:
docker rmi -f $(docker images -aq)  运用liunx的$符号删除全部容器
docker rmi -f 容器id      ##删除指定容器
docker rmi -f 容器id 容器id ……##多个容器

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值