06-Docker-Image管理操作

06-Docker-Image管理操作

Docker Version: 19.03.5

😄 Written by Zak Zhu

参考

  • Breeze老师的docker培训
  • 马哥docker视频

镜像命名规范

REGISTRY-URL/NAMESPACE/REPOSITORY:TAG

NAMESPACE一般是:

  • Organization

    Examples (<namespace>/<repository>):

    redhat/kubernets, google/kubernets

  • Login

    Examples (<namespace>/<repository>):

    alice/application, bob/application

  • Role

    Examples (<namespace>/<repository>):

    devel/database, test/database, prod/database

示例:

  • hub.docker.com/library/httpd:latest
  • quay.io/prometheus/prometheus:master
  • hub.zakzhu.top/op-base/nginx:1.17
  • hub.zakzhu.top/op-base/openresty-php:1.11.2.4-7.0.27


镜像管理命令

1


1. 拉取推送

  • pull

    Pull an image or a repository from a registry

    ## 拉取镜像
    docker image pull NAME[:TAG|@DIGEST]
    

  • push

    Push an image or a repository to a registry

    ## 推送镜像
    docker image push NAME[:TAG]
    


2. 查看操作

  • ls

    List images

    ## 列举镜像
    docker image ls [ --digests | --no-trunc | --quiet ] [REPOSITORY[:TAG]]
    

  • inspect

    Display detailed information on one or more images

    ## 镜像详细信息
    docker image inspect IMAGE [IMAGE...]
    

  • history

    Show the history of an image

    ## 镜像历史信息
    docker image history IMAGE
    


3. 本地删除

  • rm

    Remove one or more images

    ## 在宿主机上, 删除本地镜像
    docker image rm [ --force ] IMAGE [IMAGE...]
    


4. 创建标签

  • tag

    Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE

    ## 为镜像创建标签
    docker image tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG]
    


5. 导出导入

  • save

    Save one or more images to a tar archive (streamed to STDOUT by default)

    ## 导出镜像
    docker image save --output TAR_FILE IMAGE [IMAGE...]
    
  • load

    Load an image from a tar archive or STDIN

    ## 导入镜像
    docker image load --input TAR_FILE
    
posted @ 2020-01-14 14:36  ZakZhu  阅读(373)  评论(0编辑  收藏  举报