zoukankan      html  css  js  c++  java
  • Docker 常用命令——镜像

    Docker 常用命令

    帮助命令

    docker version    --版本信息
    docker info       --详细信息
    docker --help     --帮助

    镜像命令

    1.docker images    

        -- List Local images
     
    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                 #使用go模板显示格式
          --no-trunc        Don't truncate output                                   #显示完整 Image ID
      -q, --quiet           Only show numeric IDs                                   #只显示Image ID.
    示例:
    docker images
    docker images -a
    docker images -qa
    docker images -a --no-trunc
      

    2.docker search

        -- Search the Docker Hub for images 在 Docker Hub 搜索镜像
    Options:
          -f, --filter filter Filter output based on conditions provided      #过滤,通常用法 --filter stars=80
              --format string Pretty-print search using a Go template         
              --limit int Max number of search results (default 25)           #显示条目数量
              --no-trunc Don't truncate output                                #显示完整说明
    示例:
    docker search mysql
    ------------------------
    NAME                                                   DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
    mysql                                                  MySQL is a widely used, open-source relation…   7973                [OK]                
    mariadb                                                MariaDB is a community-developed fork of MyS…   2671                [OK]                
    mysql/mysql-server                                     Optimized MySQL Server Docker images. Create…   598                                     [OK]
    ​
    docker search --filter STARS=200 MYSQL
    docker search --filter is-official=true mysql
    docker search --filter is-automated=true mysql
    docker search --filter stars=200 --limit 2 mysql

    3.docker pull

        -- Pull an image or a repository from a registry 拉取镜像
    Options:
      -a, --all-tags                Download all tagged images in the repository    #下载所有版本
          --disable-content-trust   Skip image verification (default true)          #默认,跳过镜像验证  
    示例:
    docker pull mysql
    docker pull mysql:5.7.20
    docker pull redis
    docker pull tomcat
    ​
    [root@localhost ~]# docker pull mysql
    Using default tag: latest
    latest: Pulling from library/mysql
    27833a3ba0a5: Pull complete 
    864c283b3c4b: Pull complete 
    cea281b2278b: Pull complete 
    8f856c14f5af: Pull complete 
    9c4f38c23b6f: Pull complete 
    1b810e1751b3: Pull complete 
    5479aaef3d30: Pull complete 
    ded8fa2e1614: Pull complete 
    636033ba4d2e: Pull complete 
    902e6010661d: Pull complete 
    dbe44d2bf055: Pull complete 
    e906385f419d: Pull complete 
    Digest: sha256:a7cf659a764732a27963429a87eccc8457e6d4af0ee9d5140a3b56e74986eed7
    Status: Downloaded newer image for mysql:latest

    4.docker rmi

        -- Remove one or more images 删除镜像
    Options:
      -f, --force      Force removal of the image        #强制删除镜像
          --no-prune   Do not delete untagged parents    #
    示例:
    docker rmi hello-world
    docker rmi -f hello-world
    [root@localhost
    ~]# docker rmi hello-world Error response from daemon: conflict: unable to remove repository reference "hello-world" (must force) - container 3af63c5c69c6 is using its referenced image fce289e99eb9 [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3af63c5c69c6 hello-world "/hello" 5 hours ago Exited (0) 5 hours ago pensive_dubinsky [root@localhost ~]# docker rmi -f hello-world Untagged: hello-world:latest Untagged: hello-world@sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535 Deleted: sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e [root@localhost ~]# docker imag
    es -a REPOSITORY TAG IMAGE ID CREATED SIZE mysql latest 7bb2586065cd 6 days ago 477MB [root@localhost ~]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 3af63c5c69c6 fce289e99eb9 "/hello" 5 hours ago Exited (0) 5 hours ago pensive_dubinsky ​ # docker pull hello-world # docker pull nginx # docker pull redis # docker pull python # docker images REPOSITORY TAG IMAGE ID CREATED SIZE python latest 59a8c21b72d4 5 days ago 929MB redis latest a55fbf438dfd 6 days ago 95MB mysql latest 7bb2586065cd 6 days ago 477MB nginx latest 2bcb04bdb83f 6 days ago 109MB hello-world latest fce289e99eb9 3 months ago 1.84kB ​ [root@localhost ~]# docker rmi python hello-world
  • 相关阅读:
    selenium-元素无法定位解决办法
    OpenResty 最佳实践
    openresty 学习笔记小结:综合应用实例
    openresty 学习笔记六:使用session库
    openresty 学习笔记番外篇:python的一些扩展库
    openresty 学习笔记番外篇:python访问RabbitMQ消息队列
    openresty 学习笔记五:访问RabbitMQ消息队列
    openresty 学习笔记四:连接mysql和进行相关操作
    openresty 学习笔记三:连接redis和进行相关操作
    Grunt教程——初涉Grunt
  • 原文地址:https://www.cnblogs.com/plluoye/p/10658510.html
Copyright © 2011-2022 走看看