zoukankan      html  css  js  c++  java
  • Docker-镜像管理

    镜像管理

    镜像的结构:registry_name/repository_name/image_name:tag_name
    例如:docker.io/library/alpine:3.10.1

    官方镜像仓库

    注册账号

    登录hub.docker.com Web界面注册账号

    image-20210101144126999

    在docker服务器上登录上面注册的docker hub账号

    [root@progs docker]# docker login docker.io
    Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.
    Username: biaobes
    Password: 
    WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
    Configure a credential helper to remove this warning. See
    https://docs.docker.com/engine/reference/commandline/login/#credentials-store
    
    Login Succeeded
    [root@progs docker]#
    
    密码存在位置,用base64可以解码
    awk -F'"' '/"auth"/{print $(NF-1)}' /root/.docker/config.json |base64 -d
    

    image-20210101144949070

    选项

    Name, shorthand Default Description
    --all , -a Show all images (default hides intermediate images)
    --digests Show digests
    --filter , -f Filter output based on conditions provided
    --format Pretty-print images using a Go template
    --no-trunc Don’t truncate output
    --quiet , -q Only show image IDs

    搜索镜像

    命令行

    docker search alpine
    
    # 搜索星号大于3000的alpine镜像
    docker search alpine --filter=STARS=3000
    

    镜像网站上搜索

    image-20210101145200534

    下载一个镜像

    下载最新一个镜像

    docker pull alpine
    

    下载指定tag镜像

    docker pull alpine:3.10.1
    

    查看本地镜像

    docker images
    docker images ls
    

    给镜像打标签

    docker tag b7b28af77ffe biaobes/alpine:3.10.1
    

    推送镜像

    将镜像推送到docker hub仓库

    docker push biaobes/alpine:3.10.1
    

    删除镜像

    删除镜像标签

    docker rmi biaobes/alpine:3.10.1
    

    删除镜像

    # docker rmi 镜像ID
    docker rmi b7b28af77ffe
    

    删除镜像标签及镜像

    docker images | grep alpine
    
    docker rmi -f b7b28af77ffe   # -f 强制删除(包括标签及镜像)
    

    批量删除所有镜像

    docker rmi -f $(docker images -aq)
    

    附录

    https://docs.docker.com/engine/reference/commandline/image/

  • 相关阅读:
    Python NLPIR(中科院汉语分词系统)的使用 十五分钟快速入门与完全掌握
    Python NLPIR(中科院汉语分词系统)的使用 十五分钟快速入门与完全掌握
    源码:我的关于NLP的博客(持续更新中...)
    源码:我的关于NLP的博客(持续更新中...)
    orm功能封装
    元类
    事件,存储
    索引
    mysql课外积累
    day35作业
  • 原文地址:https://www.cnblogs.com/binliubiao/p/14774188.html
Copyright © 2011-2022 走看看