Habor是由VMWare公司開源的容器鏡像倉庫。事實上,Habor是在Docker Registry上進行了相應的企業級擴展,從而得到了更加普遍的應用,這些新的企業級特性包括:管理用戶界面,基於角色的訪問控制 ,AD/LDAP集成以及審計日誌等,足以知足基本企業需求。 前端
官方地址:https://vmware.github.ionginx
Github:https://github.com/goharbor/harborgit
Harbor主要功能github
基於角色訪問控制(RBAC) 在企業中,一般有不一樣的開發團隊負責不一樣的項目,鏡像像代碼同樣,每一個人角色不一樣需求也不一樣,所以就須要訪問權限控制,根據角色分配相應的權限。 例如,開發人員須要對項目構建這就用到讀寫權限(push/pull),測試人員只須要讀權限(pull),運維通常管理鏡像倉庫,具有權限分配能力,項目經理具備全部權限。
**鏡像複製** 能夠將倉庫中的鏡像同步到遠程的Harbor,相似於MySQL主從同步功能。
**LDAP** Harbor支持LDAP認證,能夠很輕易接入已有的LDAP。
**鏡像刪除和空間回收** Harbor支持在Web刪除鏡像,回收無用的鏡像,釋放磁盤空間。
**圖形頁面管理** 用戶很方面搜索鏡像及項目管理。
**審計** 對倉庫的全部操做都有記錄。
**REST API** 完整的API,方便與外部集成。
Harbor組件redis
組件 功能
harbor-adminserver 配置管理中心
harbor-db Mysql數據庫
harbor-jobservice 負責鏡像複製
harbor-log 記錄操做日誌
harbor-ui Web管理頁面和API
nginx 前端代理,負責前端頁面和鏡像上傳/下載轉發
redis 會話
registry 鏡像存儲sql
Harbor安裝有3種方式: 在線安裝:從Docker Hub下載Harbor相關鏡像,所以安裝軟件包很是小 離線安裝:安裝包包含部署的相關鏡像,所以安裝包比較大 OVA安裝程序:當用戶具備vCenter環境時,使用此安裝程序,在部署OVA後啓動Harbor 咱們採用離線安裝,首先下載離線安裝包:https://github.com/goharbor/harbor/releases
1.添加docker的yum源,能夠從阿里或騰訊等其餘源地址 2.yum install -y docker-ce && systemctl enable docker && docker start docker 3.echo 1 >> /proc/sys/net/ipv4/ip_forward && source /proc/sys/net/ip4/ip_forward 4.curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose 5. wget https://storage.googleapis.com/harbor-releases/release-1.9.0/harbor-online-installer-v1.9.0.tgz [root@git_harbor ~]# tar -zxvf harbor-offline-installer-v1.9.0.tgz -C /usr/local/ [root@git_harbor ~]# mkdir /usr/local/harbor/ssl [root@git_harbor ssl]# openssl genrsa -out ca.key 2048 Generating RSA private key, 2048 bit long modulus ..............................................................................................................................................................................+++ ......................+++ e is 65537 (0x10001) [root@git_harbor ssl]# openssl req -new -key ca.key -out ca.csr You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]: State or Province Name (full name) []: Locality Name (eg, city) [Default City]: Organization Name (eg, company) [Default Company Ltd]: Organizational Unit Name (eg, section) []: Common Name (eg, your name or your server's hostname) []:local.harbor.com Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: [root@git_harbor ssl]# [root@git_harbor ssl]# openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt Signature ok subject=/C=XX/L=Default City/O=Default Company Ltd/CN=local.harbor.com Getting Private key [root@git_harbor ssl]# vim ../harbor.yml hostname: local.harbor.com https: certificate: /usr/local/harbor/ssl/ca.crt private_key: /usr/local/harbor/ssl/ca.key [root@git_harbor harbor]# ./prepare [root@git_harbor harbor]# ./install.sh
6.修改server的hosts以及本機hosts
7.訪問Harbor
8.登陸harbor
docker login https://login.harbor.com/ -uadmindocker