Harbor配置https,並安裝內容信任插件(notary)

1.配置https

https://github.com/goharbor/harbor/blob/master/docs/configure_https.mdhtml

2.harbor安裝notary插件

./install.sh --with-notary git

3.複製證書到客戶端

開啓https後,客戶端需把ca.crt 複製到 /etc/docker/certs.d/domain.com(或ip)/ 和$HOME/.docker/tls/domain.com(ip):4443/github

4.客戶端設置環境變量 

若是要啓用內容信任以確保圖像已簽名,請在推送或拉取任何圖像以前在命令行中設置兩個環境變量 參考: https://github.com/goharbor/harbor/blob/master/docs/user_guide.md#content-trust
docker

export DOCKER_CONTENT_TRUST=1 export DOCKER_CONTENT_TRUST_SERVER=https://ip:4443
  • 開啓後如需pull或push未簽名鏡像可加參數 --disable-content-trust 例如:docker pull --disable-content-trust xxxxxxx/microservices/front-end:0.3.12
  • 構建簽名鏡像 命令爲 docker build --disable-content-trust=false -t xxx .
  • 上傳簽名鏡像需設置鏡像庫密碼,刪除簽名時須要用到(注意,設置仍是那個面的倆個環境變量)
  • 刪除簽名鏡像使用notary CLI先移除簽名後纔可刪除,參考:https://v.qq.com/x/page/n0553fzzrnf.html
    示例:./notary -s https://xxxxx:4443 --tlscacert ~/.docker/tls/xxxxx:4443/ca.crt -d ~/.docker/trust remove -p xxxxxx/tenx_containers/kfk v8.0  

5. notary CLI安裝

https://github.com/theupdateframework/notary/releases

6.有關Notary和Docker Content Trust的更多信息

請參閱Docker的文檔:https://docs.docker.com/engine/security/trust/content_trust/dom

相關文章
相關標籤/搜索