zoukankan      html  css  js  c++  java
  • 容器技术(三)镜像小结【16】

    (十三)镜像小结

    这一部分我们首先讨论了镜像的分层结构,然后学习了如何构建镜像,最后实践使用 Docker Hub 和本地 registry。

    镜像常用命令:

    images    显示镜像列表
    history   显示镜像构建历史
    commit    从容器创建新镜像
    build     从 Dockerfile 构建镜像
    tag       给镜像打 tag
    pull      从 registry 下载镜像
    push      将 镜像 上传到 registry
    rmi       删除 Docker host 中的镜像
    search    搜索 Docker Hub 中的镜像
    
    

    (1)rmi

    ​ rmi 只能删除 host 上的镜像,不会删除 registry 的镜像。如果一个镜像对应了多个 tag,只有当最后一个 tag 被删除时,镜像才被真正删除。例如 host 中 httpd 镜像有两个 tag:

    root@cuiyongchao:/dockerfile# docker images httpd
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    httpd               latest              3dd970e6b110        2 weeks ago         138MB
    httpd               v1                  3dd970e6b110        2 weeks ago         138MB
    root@cuiyongchao:/dockerfile# 
    
    

    ​ 删除其中 debian:latest 只是删除了 latest tag,镜像本身没有删除。

    root@cuiyongchao:/dockerfile# docker rmi httpd:latest 
    Untagged: httpd:latest
    root@cuiyongchao:/dockerfile# docker images httpd
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    httpd               v1                  3dd970e6b110        2 weeks ago         138MB
    root@cuiyongchao:/dockerfile# 
    
    
    

    ​ 只有当 httpd: v1 也被删除时,整个镜像才会被删除。

    root@cuiyongchao:/dockerfile# docker rmi httpd:v1 
    Untagged: httpd:v1
    Untagged: httpd@sha256:b82fb56847fcbcca9f8f162a3232acb4a302af96b1b2af1c4c3ac45ef0c9b968
    root@cuiyongchao:/dockerfile# docker images httpd
    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    root@cuiyongchao:/dockerfile# 
    
    

    (2)search

    ​ search 让我们无需打开浏览器,在命令行中就可以搜索 Docker Hub 中的镜像。

    root@cuiyongchao:/dockerfile# docker search httpd
    NAME                                    DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
    httpd                                   The Apache HTTP Server Project                  3226                [OK]                
    centos/httpd-24-centos7                 Platform for running Apache httpd 2.4 or bui…   36                                      
    centos/httpd                                                                            32                                      [OK]
    arm32v7/httpd                           The Apache HTTP Server Project                  9                                       
    arm64v8/httpd                           The Apache HTTP Server Project                  5                                       
    polinux/httpd-php                       Apache with PHP in Docker (Supervisor, CentO…   4                                       [OK]
    salim1983hoop/httpd24                   Dockerfile running apache config                2                                       [OK]
    lead4good/httpd-fpm                     httpd server which connects via fcgi proxy h…   1                                       [OK]
    solsson/httpd-openidc                   mod_auth_openidc on official httpd image, ve…   1                                       [OK]
    jonathanheilmann/httpd-alpine-rewrite   httpd:alpine with enabled mod_rewrite           1                                       [OK]
    publici/httpd                           httpd:latest                                    1                                       [OK]
    dariko/httpd-rproxy-ldap                Apache httpd reverse proxy with LDAP authent…   1                                       [OK]
    clearlinux/httpd                        httpd HyperText Transfer Protocol (HTTP) ser…   1                                       
    appertly/httpd                          Customized Apache HTTPD that uses a PHP-FPM …   0                                       [OK]
    interlutions/httpd                      httpd docker image with debian-based config …   0                                       [OK]
    e2eteam/httpd                                                                           0                                       
    amd64/httpd                             The Apache HTTP Server Project                  0                                       
    manasip/httpd                                                                           0                                       
    trollin/httpd                                                                           0                                       
    hypoport/httpd-cgi                      httpd-cgi                                       0                                       [OK]
    manageiq/httpd_configmap_generator      Httpd Configmap Generator                       0                                       [OK]
    itsziget/httpd24                        Extended HTTPD Docker image based on the off…   0                                       [OK]
    manageiq/httpd                          Container with httpd, built on CentOS for Ma…   0                                       [OK]
    alvistack/httpd                         Docker Image Packaging for Apache               0                                       [OK]
    dockerpinata/httpd                                                                      0                                       
    root@cuiyongchao:/dockerfile# 
    
    
  • 相关阅读:
    圣洁之美BY Janosch Simon
    多线程的概念讲解
    纯CSS做背景渐变
    如何用css3的boxshadow属性来为盒子增加阴影
    下载的chm文件打不开?
    大学教程:客户关系管理(CRM)复习资料
    细说CSS的transform
    浏览网页常用快捷键
    EDM邮件营销
    黑白世界,感受不同的旅行...
  • 原文地址:https://www.cnblogs.com/cuiyongchao007/p/13949804.html
Copyright © 2011-2022 走看看