zoukankan      html  css  js  c++  java
  • docker镜像命令

    镜像命令

    docker images 查看本地主机镜像
    root@t2 ~]# docker images
    REPOSITORY       TAG                 IMAGE ID           CREATED             SIZE
    hello-world       latest             bf756fb1ae65        5 months ago        13.3kB
    #REPOSITORY   镜像仓库源
    #TAG 镜像版本标签
    #IMAGE ID 镜像ID(唯一的)
    #CREATED 镜像创建时间(运行时间)
    #SIZE 镜像大小
    #同一仓库源可以有多个TAG,代表这个仓库源的不同个版本,我们使用 REPOSITORY:TAG 来定义不同的镜像。
    #如果你不指定一个镜像的版本标签,例如你只使用 ubuntu,docker 将默认使用 ubuntu:latest 镜像

    OPTIONS说明:
    a列出本地所有的镜像(含中间映像层)

    q:只显示镜像ID

    --digests:显示镜像的摘要信息

    --no-trunc:显示完整的镜像信息

    ####
    docker images -qa 拿到全部运行的容器的id
    docker search 搜索某个镜像
    [root@tzh ~]# docker search tomcat
    NAME             DESCRIPTION                                     STARS   OFFICIAL AUTOMATED
    tomcat           Apache Tomcat is an open source implementati…   2760     [OK]        
    tomee             Apache TomEE is an all-Apache Java EE certif…   79       [OK]        
    dordoka/tomcat   Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 base…   54                 [OK]
    #NAME 镜像仓库源的名称
    #DESCRIPTION 镜像说明信息
    #STARS 类似于GitHub点赞次数(越多表示越多人使用、认可)
    #OFFICIAL 是否 docker 官方发布
    #AUTOMATED 自动构建

    OPTIONS说明:
    --automated :只列出 automated build类型的镜像;

    --no-trunc :显示完整的镜像描述;

    -s :列出收藏数不小于指定值的镜像。
    docker pull 拉取镜像(docker pull tomcat 不写版本号,默认用最新的latest)
    [root@tzh ~]# docker pull tomcat
    Using default tag: latest
    latest: Pulling from library/tomcat
    e9afc4f90ab0: Pull complete
    989e6b19a265: Pull complete
    af14b6c2f878: Pull complete
    5573c4b30949: Pull complete
    fb1a405f128d: Pull complete
    612a9f566fdc: Pull complete
    cf63ebed1142: Pull complete
    fbb20561cd50: Pull complete
    e99c920870d7: Pull complete
    b7f793f2be47: Pull complete
    Digest: sha256:81c2a95e5b1b5867229d75255abe54928d505deb81c8ff8949b61fde1a5d30a1
    Status: Downloaded newer image for tomcat:latest
    docker.io/library/tomcat:latest
    docker rmi 删除镜像
    [root@tzh ~]# docker rmi hello-world
    Error response from daemon: conflict: unable to remove repository reference "hello-world" (must force) - container 82d57b7f6b19 is using its referenced image bf756fb1ae65

    正在运行的镜像不能删除(停止之后再删除或者 -f 参数强制删除)docker stop 容器id或者容器名字

    [root@tzh ~]# docker rmi -f bf756fb1ae65
    Untagged: hello-world:latest
    Untagged: hello-world@sha256:d58e752213a51785838f9eed2b7a498ffa1cb3aa7f946dda11af39286c3db9a9
    Deleted: sha256:bf756fb1ae65adf866bd8c456593cd24beb6a0a061dedf42b26a993176745f6b

    #删除多个
    语法 docker rmi name1 name2
    例子 docker rmi hello-word tomcat
    #删除全部
    语法 docker rmi -f $(docker images -qa)
  • 相关阅读:
    大厂面试高频Redis,记不住的多操作几次吧
    自动化测试系列之jenkins配置搭建环境
    关于linux服务器的磁盘监控的相关知识
    前端常见一些安全问题及解决方案
    如何使用PM2部署前端项目
    vuex状态管理器本地持久化
    关于在Vue中Typescript的写法
    websocket快速重连机制
    如何使用selenium打开多个浏览器
    运维人员踩坑记录之netplan遇坑,配置临时IP巧妙解决
  • 原文地址:https://www.cnblogs.com/hsyw/p/13193146.html
Copyright © 2011-2022 走看看