Docker学习笔记08-----Docker Harbor使用详解
Docker Harbor使用詳解
1、項目
項目包含了一個應用的所有倉庫,項目未被創建之前鏡像不能推送到Harbor。只有被授權的用戶才可以對該項目進行操作。
Harbor中有兩種項目類型:
- 公開: 任何用戶都可以從這個項目中拉取鏡像
- 私有: 僅項目成員可以從這個項目中拉取鏡像
1.1、新建項目
項目->新建項目
項目創建成功
1.2、指派用戶
如果用戶不存在,則先創建用戶。點擊“系統管理->用戶管理->新建用戶”
錄入用戶信息,點擊“確定”,創建用戶
用戶創建成功
選擇一個項目,選擇成員頁簽,點擊“用戶”
輸入用戶,選擇用戶角色,點擊“確定”
角色詳細權限
https://goharbor.io/docs/1.10/administration/managing-users/user-permissions-by-role/
總體來說角色權限分為訪客、開發者、管理者。
- 訪客: 用于拉取鏡像
- 開發者:用于拉取鏡像用于拉取、推送鏡像
- 管理者:用于管理平臺。
1.3、修改角色或移除用戶
選擇用戶,點擊“其他操作”可以對該用戶進行角色修改或從項目中移除該用戶
1.4、配置管理
在配置管理頁簽中,可以對該項目訪問級別、部署安全、漏洞掃描等進行配置
1.5、鏡像倉庫
在鏡像倉庫頁簽中,點擊“推送命令”可以看到Docker推送命令
1.6、推送鏡像
登錄倉庫
[root@localhost ~]# docker login www.xxx.com.cn:4443 Username: dev_user 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-storeLogin Succeeded標記本地倉庫
[root@localhost ~]# docker tag 4a97d3158956 www.xxx.com.cn:4443/itmrl_pub/helloworld:1.0.0 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE helloworld 1.0.0 4a97d3158956 3 days ago 659MB www.xxx.com.cn:4443/itmrl_pub/helloworld 1.0.0 4a97d3158956 3 days ago 659MB推送鏡像
[root@localhost ~]# docker push www.xxx.com.cn:4443/itmrl_pub/helloworld:1.0.0 The push refers to repository [www.xxx.com.cn:4443/itmrl_pub/helloworld] 7ecd0eab9c73: Pushed 35c20f26d188: Pushed c3fe59dd9556: Pushed 6ed1a81ba5b6: Pushed a3483ce177ce: Pushed ce6c8756685b: Pushed 30339f20ced0: Pushed 0eb22bfb707d: Pushed a2ae92ffcd29: Pushed 1.0.0: digest: sha256:74ed6579c9e1e874fe73da2a50e1b0e15dc78a67de533aa0c39facf3bfbba296 size: 22121.7、拉取鏡像
[root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE mysql 5.7 a70d36bc331a 6 weeks ago 449MB mysql latest c8562eaf9d81 6 weeks ago 546MB tomcat latest 040bdb29ab37 6 weeks ago 649MB tomcat 8.5.32 5808f01b11bf 2 years ago 463MB java 8 d23bdf5b1b1b 4 years ago 643MB [root@localhost ~]# docker pull www.yusys-sy.com.cn:4443/itmrl_pub/helloworld:1.0.0 1.0.0: Pulling from itmrl_pub/helloworld 7448db3b31eb: Already exists c36604fa7939: Already exists 29e8ef0e3340: Already exists a0c934d2565d: Already exists a360a17c9cab: Already exists cfcc996af805: Already exists 2cf014724202: Already exists 4bc402a00dfe: Already exists 353d55df259a: Pull complete Digest: sha256:74ed6579c9e1e874fe73da2a50e1b0e15dc78a67de533aa0c39facf3bfbba296 Status: Downloaded newer image for www.yusys-sy.com.cn:4443/itmrl_pub/helloworld:1.0.0 www.yusys-sy.com.cn:4443/itmrl_pub/helloworld:1.0.0 [root@localhost ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE www.yusys-sy.com.cn:4443/itmrl_pub/helloworld 1.0.0 4a97d3158956 3 days ago 659MB mysql 5.7 a70d36bc331a 6 weeks ago 449MB mysql latest c8562eaf9d81 6 weeks ago 546MB tomcat latest 040bdb29ab37 6 weeks ago 649MB tomcat 8.5.32 5808f01b11bf 2 years ago 463MB java 8 d23bdf5b1b1b 4 years ago 643MB修改項目訪問權限為私有,再次拉取
[root@localhost ~]# docker pull www.xxx.com.cn:4443/itmrl_pub/helloworld:1.0.0 Error response from daemon: unauthorized: unauthorized to access repository: itmrl_pub/helloworld, action: pull: unauthorized to access repository: itmrl_pub/helloworld, action: pull登錄后再次拉取
[root@localhost ~]# docker login www.xxx.com.cn:4443 Username: dev_user 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-storeLogin Succeeded [root@localhost ~]# docker pull www.xxx.com.cn:4443/itmrl_pub/helloworld:1.0.0 1.0.0: Pulling from itmrl_pub/helloworld 7448db3b31eb: Already exists c36604fa7939: Already exists 29e8ef0e3340: Already exists a0c934d2565d: Already exists a360a17c9cab: Already exists cfcc996af805: Already exists 2cf014724202: Already exists 4bc402a00dfe: Already exists 353d55df259a: Pull complete Digest: sha256:74ed6579c9e1e874fe73da2a50e1b0e15dc78a67de533aa0c39facf3bfbba296 Status: Downloaded newer image for www.xxx.com.cn:4443/itmrl_pub/helloworld:1.0.0 www.xxx.com.cn:4443/itmrl_pub/helloworld:1.0.02、日志
日志功能可以查看操作的日志
3、系統管理
3.1、用戶管理
維護系統用戶
3.2、分布式分發
3.3、標簽
創建標簽,用于給鏡像打標簽
3.4、項目定額
項目定額功能可以設置項目默認的磁盤空間及每個項目的磁盤空間
3.5、垃圾回收
可以手工或定時執行垃圾回收
同時查看垃圾回收的記錄和詳細日志
回收記錄
詳細日志
3.6、配置管理
認證模式
默認認證模式為數據庫認證,即用戶認證憑證存儲在本地數據庫。如果使用LDAP來認證用戶,則設置為LDAP。
允許自注冊
開啟自注冊功能后可以在登錄界面自己注冊用戶。
配置郵箱服務器
郵箱服務器用于給重置密碼的用戶發送郵件
按照官方介紹,當用戶發起密碼修改會發送郵件,但是目前測試并沒有發送。在官方Issues中查找可以發現有相關的回復如下:
在v2.2版本中email配置可能會被移除,當前功能并沒有使用。
項目創建
用戶確定哪些用戶有權限創建項目,默認為“所有人”。設置為“僅管理員”則只有管理員可以創建項目。
倉庫只讀
Harbor被設置為只讀模式,在此模式下,不能刪除倉庫、artifact、 Tag 及推送鏡像。
4、日志
日志根路徑
/var/log/harbor總結
以上是生活随笔為你收集整理的Docker学习笔记08-----Docker Harbor使用详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一款Mac平台上自带广告拦截功能插件的浏
- 下一篇: Tomcat8安装与配置