我本機的IP是172.xx.x.x,裝了一個ubuntu18的虛擬機(虛擬機的IP是192.168.33.5),下文中使用的Docker版本都是17.12。我本地使用的開發環境是Ubuntu18,在本機和虛擬機上都要安裝Docker,安裝Docker的步驟在這裏就再也不給出。目的是在虛擬機裏面安裝Harbor,以後本機推送、下載鏡像。git
從github上下載離線安裝包,下載連接,https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-offline-installer-v1.7.1.tgzgithub
List-1.1 ubuntu
#解壓 [root@localhost data]# tar xf harbor-offline-installer-v1.7.1.tgz
修改harbor/harbor.cfg的host.name和harbor_admin_password,hostname修改成虛擬機的IP,harbor_admin_password有個默認值,可是咱們在這裏修改成下,後面登陸會使用到,以下,能夠將hostname設置爲域名,如harbor.com,這樣是有好處的。api
List-2.1瀏覽器
#修改harbor.cfg [root@localhost data]# vi harbor/harbor.cfg ... #修改數據存儲的路徑 secretkey_path=xxx ... #以下爲修改後的 ...... #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. #DO NOT comment out this line, modify the value of "hostname" directly, or the installation will fail. hostname = 192.168.33.5 ...... ##The initial password of Harbor admin, only works for the first time when Harbor starts. #It has no effect after the first launch of Harbor. #Change the admin password from UI after launching Harbor. harbor_admin_password = xxxx ......
List-3.1 執行prepare文件bash
[root@localhost data]# ./harbor/prepare
List-3.2 執行install.sh文件this
[root@localhost data]# ./harbor/install.sh
以後直接用瀏覽器訪問http://192.168.33.5,就能夠看到一個登陸界面,用戶名是admin,密碼是List-2.1中的harbor_admin_password的值google
4、本地如何推送鏡像到Harbor上spa
在登陸Harbor後,首先建立用戶,以下所示,"Users" -> "NEW USER",以後會彈出一個輸入框,要咱們輸入用戶名、密碼等,這個後面會用到code
圖4.1