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