zoukankan      html  css  js  c++  java
  • Docker私有仓库Harbor(HTTP)

    Docker私有仓库Harbor

    一. docker安装

    1.1 阿里云docker源

    http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    

    1.2 安装前关闭selinux和防火墙

    # sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/sysconfig/selinux && setenforce 0
    # systemctl stop firewalld
    # systemctl disable firewalld
    

    1.3 移除旧的docker版本

    # yum remove docker 
                      docker-client 
                      docker-client-latest 
                      docker-common 
                      docker-latest 
                      docker-latest-logrotate 
                      docker-logrotate 
                      docker-selinux 
                      docker-engine-selinux 
                      docker-engine
    
    • 安装管理工具
    # yum install -y yum-utils 
               device-mapper-persistent-data 
               lvm2
    
    • 配置国内docker镜像源
    # yum-config-manager 
        --add-repo 
        http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
    
    • 查看支持的列表
    # yum list docker-ce --showduplicates | sort -r
    
    • 复制想要安装的版本执行以下命令安装
    # yum install docker-ce-<VERSION_STRING>  docker-ce-cli-<VERSION_STRING> containerd.io
    # yum install docker-ce-18.09.9-3.el7  docker-ce-cli-18.09.9-3.el7 containerd.io
    # systemctl start docker
    

    1.4 docker-compose安装

    # wget https://github.com/docker/compose/releases/download/1.24.0/docker-compose-Linux-x86_64
    # chmod +x docker-compose-Linux-x86_64
    # mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
    # docker-compose -v
    

    1.5 命令自动补全

    # yum install -y bash-completion
    

    二 安装V1.9.4

    2.1 下载最新harbor离线包

    # cd /opt && wget https://github.com/goharbor/harbor/releases/download/v1.9.4/harbor-online-installer-v1.9.4.tgz
    

    2.2 解压修改配置

    # tar xf harbor-offline-installer-v1.9.4.tgz  && cd /opt/harbor
    

    harbor.yml配置以供参考v.1.9.4版本

    hostname: harbor.evescn.com  ##可以为域名也可以ip
    http:
      port: 80
    
    data_volume: /opt/harbordata
    
    proxy:
      http_proxy:
      https_proxy:
      no_proxy: 127.0.0.1,localhost,.local,.internal,log,db,redis,nginx,core,portal,postgresql,jobservice,registry,registryctl,clair
      components:
        - core
        - jobservice
        - clair
    

    2.3 启动服务

    执行命令生成docker-compose.yml文件

    ./prepare --with-clair --with-chartmuseum 
      ##如果不想保存helm的chart仓库就不要带这2个参数
    
    ./install.sh
    

    2.4 访问配置中设置的域名(或主机IP)即可

    2.4.1 新建evescn用户

    使用 admin/Harbor12345登录web服务器
    点击系统管理,选择用户管理
    选择新建用户,新建evescn用户,以便后续拉取推送代码
    

    2.4.2 新建evescn项目(仓库名)

    使用 admin/Harbor12345登录web服务器
    点击项目,选择新建项目
    新建evescn项目,以便后续拉取推送代码
    

    2.4.3 项目添加用户

    使用 admin/Harbor12345登录web服务器
    点击evescn项目,选择成员
    点击用户,添加evescn用户为项目管理员
    

    新建evescn仓库

    三 客户端pull/push镜像

    3.1 修改daemon.json

    • 编辑daemon.json
    vim /etc/docker/daemon.json
     # 添加下面的内容,wq保存。 
    
    {
      "insecure-registries":["harbor.evescn.com"]
    }
    

    3.2 修改hosts.conf

    192.168.21.129 harbor.evescn.com
    

    3.3 重启docker

    # systemctl restart docker
    

    3.4 客户端登录

    # docker login harbor.evescn.com  (evescn账户需要提交到harbor web界面创建)
    Username: evescn
    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
    

    3.5 docker镜像推送

    # docker tag 59788edf1f3e harbor.evescn.com/evescn/busybox:v1.0
    # docker push harbor.evescn.com/evescn/busybox:v1.0
    

    3.6 docker镜像拉取

    # docker rmi harbor.evescn.com/evescn/busybox:v1.0
    # docker pull harbor.evescn.com/evescn/busybox:v1.0
    
  • 相关阅读:
    设备驱动开发之缓冲区读写操作
    什么是80Plus
    INF Manufacturer Section
    C++编程获得某台机器的IP地址
    INF DestinationDirs Section
    importlib模块
    django的内置信号
    auth模块(登录验证)
    头像文件的预览
    powerDesiger 常用设置
  • 原文地址:https://www.cnblogs.com/evescn/p/12205910.html
Copyright © 2011-2022 走看看