zoukankan      html  css  js  c++  java
  • docker images

    列出本地镜像

    语法

    docker image ls [OPTIONS] [REPOSITORY[:TAG]]

    选项说明

    •  -a,--all            显示所有镜像,包括中间层镜像
    • --digests            显示镜像摘要,默认不显示
    • -f,--filter          根据条件过滤镜像
    • --format            使用Go模板打印镜像
    • --no-trunc          不要截断输出
    • -q,--quiet         只显示镜像ID

    实例

    查看本地镜像(不显示中间层镜像)

    docker images #同docker image ls

    • REPOSITORY   镜像的仓库源
    • TAG        镜像的标签
    • IMAGE ID     镜像的id
    • CREATED      镜像的创建时间
    • SIZE       镜像的大小

    查看所有镜像,包括中间层镜像

    docker images -a

    按名称显示镜像

    docker images python

    按标签显示镜像

    docker images python:latest

    显示完整的 IMAGE ID

    docker images --no-trunc
    

    显示镜像的摘要

    docker images --digests
    

    只显示镜像ID

    docker images -q
    

    条件过滤

    支持的条件有:

    • dangling         悬空镜像,默认为 false
    • label              对应 DockerFile 中的 LABEL,格式为:label=<key> 或 label=<key>=<value>
    • before            显示给定 id 或 引用之前创建的过滤器的镜像
    • since              过滤自给定id或引用以来创建的镜像
    • reference        过滤参考与指定模式匹配的镜像

    1)查询所有虚悬镜像(未标记的镜像)

    docker images -f dangling=true

    2)查询指定标签的镜像

    在镜像详情中可以查看到镜像的 label

    通过 label=<key> 过滤镜像

    docker images -f "label=org.label-schema.build-date"

    通过 label=<key>=<value> 过滤镜像

    docker images -f "label=org.label-schema.build-date=20201204"

    3)显示 python 镜像之前创建的镜像

    docker images -f before=python
    

    4)显示 python:slim 镜像之前创建的镜像

    docker images -f before=python:slim

    5)显示 python 镜像之后创建的镜像

    docker images -f since=python

    6)通过参考过滤镜像

    docker images -f reference=python

    格式化输出

    GO 模板的有效占位符:

    .ID                           镜像ID

    .Repository               镜像库

    .Tag                         镜像标记

    .Digest                     镜像摘要

    .CreatedSince           镜像自创建以来经过的时间

    .CreatedAt                镜像创建时间

    .Size                        镜像大小

    1)以不带列名的方式打印

    docker images --format "{{.ID}}: {{.Tag}}: {{.Size}}"

    2)以表格方式打印

    docker images --format "table{{.ID}}	{{.Tag}}	{{.Size}}"

  • 相关阅读:
    nginx一键安装脚本
    nginx动静分离之后,设置默认主页
    日志备份
    cc高防主机部署
    原型和原型链
    Git&Github分支
    Git&Github基础
    传输层协议TCP&UDP
    本地库与远程库交互
    SVG
  • 原文地址:https://www.cnblogs.com/scholars-xian/p/14557388.html
Copyright © 2011-2022 走看看