1 Harbor简介
Harbor是由VMWare公司开源的容器镜像仓库。实际上,Harbor是在Docker Registry上进行相应的企业级扩展,从而获得了更加广泛的应用。
组件 | 功能 |
---|---|
harbor-adminserver | 配置管理中心 |
harbor-db | mysql数据库 |
harbor-jobservice | 负责镜像复制 |
harbor-log | 记录操作日志 |
harbor-ui | web管理页面和API |
nginx | 前端代理 |
redis | 会话 |
registry | 镜像存储 |
2 Harbor下载
官网地址:
https://vmare.github.io/harbor/cn/
3 Harbor安装
3.1 在线安装
从docker hub下载harbor相关镜像,安装软件包非常小。
3.2 离线安装
安装包包含部署的相关镜像,安装包较大。
3.3 OVA安装程序
当用户有vCenter环境时,使用此安装程序,再部署OVA后启动Harbor。
3.4 具体操作
3.4.1 先同步时间
ntpdate time.windows.com
3.4.2 安装
3.4.2.1 上传docker-compose
# chmod +x docker-compose-Linux-x86_64
#
# mv docker-compose-Linux-x86_64 /usr/bin/docker-compose
3.4.2.2 解压harbor
# tar zxvf harbor-offline-installer-v1.6.1.tgz
解压结果:
harbor/common/templates/
harbor/common/templates/nginx/
harbor/common/templates/nginx/nginx.https.conf
harbor/common/templates/nginx/notary.server.conf
harbor/common/templates/nginx/nginx.http.conf
harbor/common/templates/nginx/notary.upstream.conf
harbor/common/templates/notary/
harbor/common/templates/notary/notary-signer.crt
harbor/common/templates/notary/signer-config.json
harbor/common/templates/notary/notary-signer-ca.crt
harbor/common/templates/notary/signer_env
harbor/common/templates/notary/server_env
harbor/common/templates/notary/signer-config.postgres.json
harbor/common/templates/notary/server-config.json
harbor/common/templates/notary/notary-signer.key
harbor/common/templates/notary/server-config.postgres.json
harbor/common/templates/adminserver/
harbor/common/templates/adminserver/env
harbor/common/templates/chartserver/
harbor/common/templates/chartserver/env
harbor/common/templates/db/
harbor/common/templates/db/env
harbor/common/templates/registry/
harbor/common/templates/registry/root.crt
harbor/common/templates/registry/config.yml
harbor/common/templates/registryctl/
harbor/common/templates/registryctl/env
harbor/common/templates/registryctl/config.yml
harbor/common/templates/log/
harbor/common/templates/log/logrotate.conf
harbor/common/templates/jobservice/
harbor/common/templates/jobservice/env
harbor/common/templates/jobservice/config.yml
harbor/common/templates/core/
harbor/common/templates/core/env
harbor/common/templates/core/private_key.pem
harbor/common/templates/core/app.conf
harbor/common/templates/clair/
harbor/common/templates/clair/postgres_env
harbor/common/templates/clair/config.yaml
harbor/common/templates/clair/postgresql-init.d/
harbor/common/templates/clair/postgresql-init.d/README.md
harbor/common/templates/clair/clair_env
harbor/harbor.v1.7.5.tar.gz
harbor/prepare
harbor/LICENSE
harbor/install.sh
harbor/harbor.cfg
harbor/docker-compose.yml
harbor/open_source_license
harbor/docker-compose.notary.yml
harbor/docker-compose.clair.yml
harbor/docker-compose.chartmuseum.yml
3.4.2.3 执行prepare
# ./prepare
3.4.2.4 修改harbor的配置文件
# cd harbor
# vi harbor.cfg
hostname = 192.168.xx.xx
ui_url_protocol = http
3.4.2.5 install
# ./install.sh
3.4.2.6 查看日志
ls /var/log/harbor
3.4.2.7 访问
4 Harbor基本使用
4.1 配置http镜像仓库可信任
# vi /etc/docker/daemon.json
{"insecure-registries":["reg.ctnrs.com"]}
# systemctl restart docker
4. 2 打标签
# docker tag centos:6 reg.ctnrs.com/library/centos:6
4.3 上传
# docker push reg.ctnrs.com/library/centos:6
4.4 下载
# docker pull reg.ctnrs.com/library/centos:6