zoukankan      html  css  js  c++  java
  • Docker: 仓库管理

    docker respository

    分为公共仓库与私有仓库两种。

    • 注册服务器 registry: 存放仓库的具体服务器,可容纳多个仓库
    • 仓库 regisitory: 存放镜像的一个具体的项目目录,可容纳多个镜像

    example:

    kumata-docker.com/test-image
    // kumata-docker.com -> registry
    // test-image -> regisitory
    

    1. 公共镜像市场

    Docker official address: https://hub.docker.com/

    // login, it will create ~/.docker/config.json
    docker login
    
    // 基操
    // 基础镜像/根镜像,一般为单个单词的名字
    docker pull centos
    // 用户创建并维护,一般为 用户名/镜像名
    docker pull hyperledger/explorer
    
    

    2. 搭建本地私有仓库

    1. 自动下载并启动一个registry contain,默认创建在 /var/lib/registry 下:
    // use registry create private regisitory
    docker run -d -p 5000:5000 registry:2
    
    // -v 指定位置
    docker run -d -p 5000:5000 -v /opt/data/registry:/var/lib/registr registry:2
    
    1. 管理私有仓库
    // watch
    docker images
    
    REPOSITORY TAG IMAGE ID CREATED SIZE
    ubuntu latest f643c72bc252 12 days ago 72.9MB
    // add tag to image 
    docker tag ubuntu:latest 10.8.9.40:5000/ubuntu_test
    
    REPOSITORY TAG IMAGE ID CREATED SIZE
    10.8.9.40:5000/ubuntu_test latest f643c72bc252 12 days ago 72.9MB

    Add http config

    sudo vim /etc/docker/daemon.json
    // add
    {"insecure-registries":["10.8.9.40:5000"]}
    // restart docker
    sudo systemctl daemon-reload
    sudo systemctl restart docker
    

    push and pull

    // push to registory
    docker push 10.8.9.40:5000/ubuntu_test
    
    // pull image
    docker pull 10.8.9.40:5000/ubuntu_test
    
    // if need, add tag:
    docker tag 10.8.9.40:5000/ubuntu_test ubuntu_kumata:18.04
    
  • 相关阅读:
    用魔数防范文件上传攻击
    nginx http跳转到https
    tengine安装
    版本标记说明
    nginx基于域名的虚拟主机 反向代理配置实例
    非ROOT用户启动Tomcat
    使用druid连接池的超时回收机制排查连接泄露问题
    Jenkins入门系列之
    centos7 关闭SELINUX 防火墙
    mac安装IE浏览器
  • 原文地址:https://www.cnblogs.com/kumata/p/14104057.html
Copyright © 2011-2022 走看看