美文网首页
基于docker-compose 安装harbor

基于docker-compose 安装harbor

作者: Lucie_xxm | 来源:发表于2019-08-13 10:26 被阅读0次

    harbor特性

    • 基于角色的访问控制:用户和存储库是通过“项目”组织的,用户可以对多个镜像仓库统一命名空间拥有不同的权限。

    • 镜像复制:可以基于具有多个Registry实例之间复制(同步)图像和图表。如果出现任何错误,Harbor会自动重试复制。非常适合于负载平衡、高可用性、多数据中心、混合和多云场景。

    • LDAP/AD支持:Harbor与现有企业LDAP/AD集成,用于用户身份验证和管理,并支持将LDAP组导入Harbor并为其分配适当的项目角色。
    • 镜像删除和垃圾收集:镜像可以删除,其空间可以回收。

    • 国际化:对多国语言支持(已拥有中文、英文、德文、日语和俄文);

    • 图形化用户界面:用户可以轻松浏览、搜索存储库和管理项目。

    • 审计管理:跟踪到存储库的所有操作。

    • RESTful API:用于大多数管理操作的RESTful API,易于与外部系统集成。一个嵌入式的Swagger用户界面可用于探索和测试API。

    • 简单部署:提供在线和离线安装程序。此外,可以安装到vSphere平台的(OVA方式)虚拟设备。

    Harbor 组件

    • proxy:Harbor的组件,如注册表、UI和令牌服务,都位于反向代理之后。代理将来自浏览器和Docker客户机的请求转发到各种后端服务。
    • Registry:负责存储Docker镜像和处理Docker推/拉命令。由于Harbor需要对映像进行访问权限控制,Registry将引导客户机访问令牌服务,以便为每个pull或push请求获取有效的令牌(token)。
    • Core Service:Harbor的核心功能,主要提供以下服务:

      • UI:提供图像化的图形用户界面,帮助人户管理镜像和对用户授权。

      • webhook: 为了及时获取registry上images的状态变化的情况,在Registry上配置webhook,把状态变化传递UI模块;

      • Token令牌服务:负责根据用户在项目中的角色为每个docker push/pull命令颁发令牌。如果从Docker客户机发送的请求中没有令牌,注册表将把请求重定向到令牌服务。

    • Datebase:为了给core services提供数据库舒服,负责储存用户权限、审计日志、Docker image分组信息等数据。

    • Job Services:提供镜像远程负责功能,能把本地镜像同步到其他harbor实例当中。

    • Log Collector:为了帮助监控Harbor运行,负责手机其他组件的log,供日后分析。

    harbor 安装

    harbor github 地址 https://github.com/goharbor/harbor

    harbor 官方安装教程

    下载tar包

    放到在相应的目录/usr/local/docker/ 解压

    tar xvf harbor-offline-installer-<version>.tgz
    

    解压后 获取的文件夹及文件

    修改harbor.yml配置

    修改主机ip 但是不能使用127.0.0.1 or localhost 默认账号密码admin/Harbor12345 这里修改密码改成123456 配置日志和data地址按实际来配置

    # Configuration file of Harbor
    
    # The IP address or hostname to access admin UI and registry service.
    # DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
    hostname: 120.79.10.212
    
    # http related config
    http:
      # port for http, default is 80. If https enabled, this port will redirect to https port
      port: 80
    
    # https related config
    # https:
    #   # https port for harbor, default is 443
    #   port: 443
    #   # The path of cert and key files for nginx
    #   certificate: /your/certificate/path
    #   private_key: /your/private/key/path
    
    # Uncomment external_url if you want to enable external proxy
    # And when it enabled the hostname will no longer used
    # external_url: https://reg.mydomain.com:8433
    
    # The initial password of Harbor admin
    # It only works in first time to install harbor
    # Remember Change the admin password from UI after launching Harbor.
    harbor_admin_password: 123456
    
    # Harbor DB configuration
    database:
      # The password for the root user of Harbor DB. Change this before any production use.
      password: 123456
    
    # The default data volume
    data_volume: /usr/local/docker/harbor/data
    
    # Harbor Storage settings by default is using /data dir on local filesystem
    # Uncomment storage_service setting If you want to using external storage
    # storage_service:
    #   # ca_bundle is the path to the custom root ca certificate, which will be injected into the truststore
    #   # of registry's and chart repository's containers.  This is usually needed when the user hosts a internal storage with self signed certificate.
    #   ca_bundle:
    
    #   # storage backend, default is filesystem, options include filesystem, azure, gcs, s3, swift and oss
    #   # for more info about this configuration please refer https://docs.docker.com/registry/configuration/
    #   filesystem:
    #     maxthreads: 100
    #   # set disable to true when you want to disable registry redirect
    #   redirect:
    #     disabled: false
    
    # Clair configuration
    clair: 
      # The interval of clair updaters, the unit is hour, set to 0 to disable the updaters.
      updaters_interval: 12
    
      # Config http proxy for Clair, e.g. http://my.proxy.com:3128
      # Clair doesn't need to connect to harbor internal components via http proxy.
      http_proxy:  
      https_proxy:
      no_proxy: 127.0.0.1,localhost,core,registry
    
    jobservice:
      # Maximum number of job workers in job service  
      max_job_workers: 10
    
    chart:
      # Change the value of absolute_url to enabled can enable absolute url in chart
      absolute_url: disabled
    
    # Log configurations
    log:
      # options are debug, info, warning, error, fatal
      level: info
      # Log files are rotated log_rotate_count times before being removed. If count is 0, old versions are removed rather than rotated.
      rotate_count: 50
      # Log files are rotated only if they grow bigger than log_rotate_size bytes. If size is followed by k, the size is assumed to be in kilobytes. 
      # If the M is used, the size is in megabytes, and if G is used, the size is in gigabytes. So size 100, size 100k, size 100M and size 100G 
      # are all valid.
      rotate_size: 200M
      # The directory on your host that store log
      location: /usr/local/docker/harbor/log/
    #This attribute is for migrator to detect the version of the .cfg file, DO NOT MODIFY!
    _version: 1.8.0
    

    退出保存配置完成

    启动install.sh脚本

    ./install.sh
    

    查看启动服务

    docker ps | grep goharbor 
    

    验证启动成功

    访问ip地址

    120.79.10.212
    

    输入admin/123456登陆成功

    相关文章

      网友评论

          本文标题:基于docker-compose 安装harbor

          本文链接:https://www.haomeiwen.com/subject/cxqvjctx.html