zoukankan      html  css  js  c++  java
  • docker笔记之镜像管理

    1.查找镜像

    docker search centos
    NAME                               DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
    centos                             The official build of CentOS.                   5556                [OK]                
    ansible/centos7-ansible            Ansible on Centos7                              123                                     [OK]
    jdeathe/centos-ssh                 CentOS-6 6.10 x86_64 / CentOS-7 7.6.1810 x86…   112                                     [OK]
    

    说明:
    NAME:镜像名称
    DESCRIPTION:镜像描述
    STARS:星标数量,类似GitHub上的星标,数量越多,获得的认可越高
    OFFICIAL :是否为官方镜像
    AUTOMATED:是否自动化创建

    2.下载镜像

    [root@heibing ~]# docker pull centos
    Using default tag: latest
    latest: Pulling from library/centos
    d8d02d457314: Pull complete 
    Digest: sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb
    Status: Downloaded newer image for centos:latest
    docker.io/library/centos:latest
    
    

    备注:此处一定要配置镜像加速,默认配置下,docker会从官方地址下载镜像,由于墙的原因,
    下载速度非常缓慢,建议修改镜像地址为阿里云,登录阿里云,容器和镜像服务器,镜像加速器里有相关说明。

    3.查看镜像

    [root@heibing ~]# docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    centos              latest              67fa590cfc1c        3 weeks ago         202MB
    nginx               latest              5a3221f0137b        3 weeks ago         126MB
    
    

    说明:
    REPOSITORY:镜像名称
    TAG:标签
    IMAGE ID: 镜像ID(唯一)
    CREATED:创建时间
    SIZE:镜像大小

    4.删除镜像

    [root@heibing ~]# docker rmi centos  
    Untagged: centos:latest
    Untagged: centos@sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb
    Deleted: sha256:67fa590cfc1c207c30b837528373f819f6262c884b7e69118d060a0c04d70ab8
    Deleted: sha256:877b494a9f30e74e61b441ed84bb74b14e66fb9cc321d83f3a8a19c60d078654
    
    #查看删除结果
    [root@heibing ~]# docker images
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    nginx               latest              5a3221f0137b        3 weeks ago         126MB
    
    

    5.关于镜像操作的其他命令:

    [root@heibing ~]# docker image 
    
    Usage:	docker image COMMAND
    
    Manage images
    
    Commands:
      build       Build an image from a Dockerfile-->通过dockerfile文件创建一个镜像
      history     Show the history of an image-->查看某个镜像的历史信息
      import      Import the contents from a tarball to create a filesystem image-->从压缩文件导入内容创建镜像
      inspect     Display detailed information on one or more images-->显示镜像的更多信息
      load        Load an image from a tar archive or STDIN-->加载镜像
      ls          List images-->显示镜像列表
      prune       Remove unused images-->删除不在使用的镜像
      pull        Pull an image or a repository from a registry-->从库中拉取镜像
      push        Push an image or a repository to a registry-->向库中推送镜像
      rm          Remove one or more images-->删除镜像文件
      save        Save one or more images to a tar archive (streamed to STDOUT by default)-->保存容器内容到镜像
      tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE-->创建镜像标签
    
    Run 'docker image COMMAND --help' for more information on a command.
    
    
  • 相关阅读:
    [Vim].vimrc
    [笔试面试][code_by_hand]压缩字符串
    [笔试面试][code_by_hand]输出第二个字符串在第一个字符串中的连接次序
    [笔试面试]串s1="ABCDACDAE" s2="DAE" 找出s1中,包含s2的最小子串,要求该子串含有s2中的所有字符,串内字符无顺序关系
    [笔试面试][code_by_hand]从二元树中找出和为某一值的所有路径
    DEV 皮肤的使用
    Dev GridControl使用小结
    [转载]DEV控件:gridControl常用属性设置
    C#网页 自动登录 提交POST信息 方法
    比较字符串NSString
  • 原文地址:https://www.cnblogs.com/cangyuefeng/p/11504722.html
Copyright © 2011-2022 走看看