文档章节

VMware Harbor registry 安装及使用

z
 zzimac
发布于 09/13 10:45
字数 1533
阅读 34
收藏 0

Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器,通过添加一些企业必需的功能特性,例如安全、标识和管理等,扩展了开源Docker Distribution。作为一个企业级私有Registry服务器,Harbor提供了更好的性能和安全。提升用户使用Registry构建和运行环境传输镜像的效率。Harbor支持安装在多个Registry节点的镜像资源复制,镜像全部保存在私有Registry中, 确保数据和知识产权在公司内部网络中管控。另外,Harbor也提供了高级的安全特性,诸如用户管理,访问控制和活动审计等。

这个软件, 提供Docker镜像的常用管理功能, 不像 docker registry 一样,只能上传、下载,没法查询删除,且它的版本近4年没更新了。
    
Harbor下载网址:https://github.com/goharbor/harbor/releases    
注意要下载离线版本,而不是在线版,除非你愿意。


    
1. 开始安装Harbor前,新增epel repo, 先安装docker (1.13.x) , docker-compose (1.10.x),并启动docker服务

# yum-config-manager --add-repo http://mirrors.aliyun.com/epel/7/x86_64
# yum install docker docker-compose
# systemctl enable docker && systemctl start docker

2. 下载并解压离线安装包,并进入其目录。修改harbor.cfg配置文件hostname为你需要的主机域名后,开始安装(vmware把这脚本写太好,各容器导入、配置、映射等都处理好了,傻瓜式体验)

# wget https://storage.googleapis.com/harbor-releases/harbor-offline-installer-v1.5.3.tgz
# tar zxpf harbor-offline-installer-v1.5.3.tgz
# sed -i "s|reg.mydomain.com|YOUR.DNS.DOMAIN.NAME|g" harbor/harbor.cfg
# sed -i "s|Harbor12345|YourWebUIadminPassword|g" harbor/harbor.cfg


3. 创建ssl证书,并更新配置文件

# mkdir -p /data/cert
# openssl req -x509 -nodes -newkey rsa:4096 -sha256 -days 999 \
    -keyout /data/cert/ispcdocker.com.key \
    -out /data/cert/ispcdocker.com.crt \
    -subj "/C=CN/ST=docker/L=wuhan/O=ispc/OU=New site/CN=ispcdocker.com/emailAddress=macj@ispcdocker.com"

# sed -i "s|server.crt|ispcdocker.com.crt|g" harbor/harbor.cfg
# sed -i "s|server.key|ispcdocker.com.key|g" harbor/harbor.cfg
# sed -i "s|ui_url_protocol = http|ui_url_protocol = https|g" harbor/harbor.cfg

docker 客户端服务器,需新增目录/etc/docker/certs.d/ispcdocker.com,并放入证书文件 ispcdocker.com.crt
    
4. 开始安装
# ./harbor/install.sh 

[Step 0]: checking installation environment ...
Note: docker version: 1.13.1
Note: docker-compose version: 1.18.0

[Step 1]: loading Harbor images ...
dba693fc2701: Loading layer [==================================================>] 133.4 MB/133.4 MB
2a5686d9628d: Loading layer [==================================================>] 30.09 MB/30.09 MB
d36839094404: Loading layer [==================================================>] 12.16 MB/12.16 MB
d7d603a1fc1b: Loading layer [==================================================>]  17.3 MB/17.3 MB
0f4a9a0efd40: Loading layer [==================================================>] 15.87 kB/15.87 kB
c3f3baab14ec: Loading layer [==================================================>] 3.072 kB/3.072 kB
7dfec12d33a9: Loading layer [==================================================>] 29.46 MB/29.46 MB
Loaded image: vmware/notary-server-photon:v0.5.1-v1.5.3
d4718453703e: Loading layer [==================================================>] 165.3 MB/165.3 MB
d1ce74e3e78b: Loading layer [==================================================>] 10.93 MB/10.93 MB
ac11a823a541: Loading layer [==================================================>] 2.048 kB/2.048 kB
f998dbfce255: Loading layer [==================================================>] 48.13 kB/48.13 kB
236d02b5f213: Loading layer [==================================================>] 10.97 MB/10.97 MB
Loaded image: vmware/clair-photon:v2.0.5-v1.5.3
a5c06f1276a9: Loading layer [==================================================>]   410 MB/410 MB
8cb6e0c2cee6: Loading layer [==================================================>] 9.216 kB/9.216 kB
e5242ff0e21c: Loading layer [==================================================>] 9.216 kB/9.216 kB
565919f93038: Loading layer [==================================================>]  7.68 kB/7.68 kB
c59fe8aadc39: Loading layer [==================================================>] 1.536 kB/1.536 kB
9d5156272f97: Loading layer [==================================================>] 11.78 kB/11.78 kB
82107159e9cf: Loading layer [==================================================>]  2.56 kB/2.56 kB
45f5d9c065c0: Loading layer [==================================================>] 3.072 kB/3.072 kB
Loaded image: vmware/harbor-db:v1.5.3
8c31ce3b9459: Loading layer [==================================================>] 89.33 MB/89.33 MB
318b6651319e: Loading layer [==================================================>] 3.072 kB/3.072 kB
c839c1286b82: Loading layer [==================================================>]  59.9 kB/59.9 kB
7d474fe49011: Loading layer [==================================================>] 61.95 kB/61.95 kB
Loaded image: vmware/redis-photon:v1.5.3
be289099e564: Loading layer [==================================================>] 11.97 MB/11.97 MB
Loaded image: vmware/nginx-photon:v1.5.3
b4b466185e6a: Loading layer [==================================================>] 30.09 MB/30.09 MB
0cc49b6cc09c: Loading layer [==================================================>] 20.91 MB/20.91 MB
51763c526b85: Loading layer [==================================================>] 20.91 MB/20.91 MB
Loaded image: vmware/harbor-jobservice:v1.5.3
78ee9810b0f6: Loading layer [==================================================>] 102.5 MB/102.5 MB
7ad0f67912f5: Loading layer [==================================================>] 6.656 kB/6.656 kB
742c91b5588b: Loading layer [==================================================>] 2.048 kB/2.048 kB
0f6bb290e555: Loading layer [==================================================>]  7.68 kB/7.68 kB
Loaded image: vmware/postgresql-photon:v1.5.3
454c81edbd3b: Loading layer [==================================================>] 135.2 MB/135.2 MB
e99db1275091: Loading layer [==================================================>] 395.4 MB/395.4 MB
051e4ee23882: Loading layer [==================================================>] 9.216 kB/9.216 kB
6cca4437b6f6: Loading layer [==================================================>] 9.216 kB/9.216 kB
1d48fc08c8bc: Loading layer [==================================================>]  7.68 kB/7.68 kB
0419724fd942: Loading layer [==================================================>] 1.536 kB/1.536 kB
543c0c1ee18d: Loading layer [==================================================>] 655.2 MB/655.2 MB
4190aa7e89b8: Loading layer [==================================================>] 103.9 kB/103.9 kB
Loaded image: vmware/harbor-migrator:v1.5.0
Loaded image: photon:1.0
1cb3e179ad43: Loading layer [==================================================>] 10.95 MB/10.95 MB
fc6a61e18876: Loading layer [==================================================>]  17.3 MB/17.3 MB
9a0e4d2eebcc: Loading layer [==================================================>] 15.87 kB/15.87 kB
db1781274784: Loading layer [==================================================>] 3.072 kB/3.072 kB
8f838ad4a4a8: Loading layer [==================================================>] 28.24 MB/28.24 MB
Loaded image: vmware/notary-signer-photon:v0.5.1-v1.5.3
Loaded image: vmware/mariadb-photon:v1.5.3
18726298d495: Loading layer [==================================================>] 30.09 MB/30.09 MB
b9ed103273e7: Loading layer [==================================================>]  2.56 kB/2.56 kB
c70c3ca2b37a: Loading layer [==================================================>]  2.56 kB/2.56 kB
adff27057ad4: Loading layer [==================================================>] 2.048 kB/2.048 kB
f6616ceb4679: Loading layer [==================================================>]  22.8 MB/22.8 MB
bc864fbf8cf5: Loading layer [==================================================>]  22.8 MB/22.8 MB
Loaded image: vmware/registry-photon:v2.6.2-v1.5.3
7d62cd6592f6: Loading layer [==================================================>] 30.09 MB/30.09 MB
86b34d4705c7: Loading layer [==================================================>] 15.37 MB/15.37 MB
c39dac15ee95: Loading layer [==================================================>] 15.37 MB/15.37 MB
Loaded image: vmware/harbor-adminserver:v1.5.3
8b4d494f800d: Loading layer [==================================================>] 30.09 MB/30.09 MB
c2125811685a: Loading layer [==================================================>] 24.41 MB/24.41 MB
8d81b9f3593b: Loading layer [==================================================>] 7.168 kB/7.168 kB
027ed79fa3f9: Loading layer [==================================================>] 10.56 MB/10.56 MB
e293dcd69589: Loading layer [==================================================>]  24.4 MB/24.4 MB
Loaded image: vmware/harbor-ui:v1.5.3
c8de2c0f8a35: Loading layer [==================================================>] 79.91 MB/79.91 MB
95e6a55db9bc: Loading layer [==================================================>] 3.584 kB/3.584 kB
eec0ff35e410: Loading layer [==================================================>] 3.072 kB/3.072 kB
6db6ff46ce4a: Loading layer [==================================================>] 4.096 kB/4.096 kB
6f2de56be0b2: Loading layer [==================================================>] 3.584 kB/3.584 kB
7f4232890807: Loading layer [==================================================>] 9.728 kB/9.728 kB
Loaded image: vmware/harbor-log:v1.5.3


[Step 2]: preparing environment ...
Generated and saved secret to file: /data/secretkey
Generated configuration file: ./common/config/nginx/nginx.conf
Generated configuration file: ./common/config/adminserver/env
Generated configuration file: ./common/config/ui/env
Generated configuration file: ./common/config/registry/config.yml
Generated configuration file: ./common/config/db/env
Generated configuration file: ./common/config/jobservice/env
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/jobservice/config.yml
Generated configuration file: ./common/config/ui/app.conf
Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt
The configuration files are ready, please use docker-compose to start the service.
Creating harbor-log ... done

[Step 3]: checking existing instance of Harbor ...
Creating redis ... done
Creating harbor-ui ... done
Creating network "harbor_harbor" with the default driver
Creating nginx ... done
Creating redis ... 
Creating registry ... 
Creating harbor-db ... 
Creating harbor-adminserver ... 
Creating harbor-ui ... 
Creating harbor-jobservice ... 
Creating nginx ... 

✔ ----Harbor has been installed and started successfully.----

Now you should be able to visit the admin portal at https://ispcdocker.com. 
For more details, please visit https://github.com/vmware/harbor .

5. 如果配置文件打算修改,并重新安装, 可用下面方式简单处理
# docker-compose down     ## 第一步停止harbor
# vim harbor.cfg         ## 修改镜像
# install.sh             ## 重新初始化镜像

6. 重启harbor
# docker-compose stop
# docker-compose up -d 

6. 登录默认的密码是 admin/Harbor12345 ,此密码在压缩包内的harbor.cfg配置文件中设定。


7. 用户指南
    https://github.com/goharbor/harbor/blob/master/docs/user_guide.md
    此软件的开源版本,仅提供docker镜像的各管理功能,无其他。 且有中文界面可供选择,操作很容易


8.     docker 客户端服务器,需将新增目录/etc/docker/certs.d/ispcdocker.com,并放入前面步骤创建的证书文件ispcdocker.com.crt (拷贝、下载、粘贴复制方法不限,整过去就行)

# wget -P /etc/docker/certs.d/ispcdocker.com http://10.245.254.93/linux/soft/docker/ispcdocker.com.crt  #(use for docker client before pull image)
# docker login --username=admin ispcdocker.com
# docker tag SOURCE_IMAGE[:TAG] ispcdocker.com/library/IMAGE[:TAG]
# docker push ispcdocker.com/library/IMAGE[:TAG]

 

© 著作权归作者所有

共有 人打赏支持
z
粉丝 3
博文 75
码字总数 15979
作品 0
武汉
私信 提问
swarm 部署高可用harbor

harbor官方下载地址: https://github.com/vmware/harbor/releases 配置参考: https://github.com/vmware/harbor/blob/master/docs/installationguide.md 此处使用离线下载安装包: wget h......

Wilson9527
06/14
0
0
企业级Docker Registry开源工具Harbor的介绍以及使用指南

Harbor 的简介以及基本架构 Harbor简介 基本架构 Harbor安装和配置指导 Harbor 可以使用以下三种方式进行安装部署: 在线安装: 使用者可以直接从docker hub上下载harbor的官方镜像。 离线安装...

Andy-xu
2016/11/12
881
0
Ubuntu安装私有Docker Hub服务Harbor

Harbor是VMWare开发的一个私有Docker-hub服务软件,依赖于docker registry服务,现在已开源(https://github.com/vmware/harbor)。查看完整的安装和配置说明(https://github.com/vmware/ha...

openthings
2016/04/14
602
0
用分布式存储VSAN实现Harbor Registry的高可用方案

用分布式存储VSAN实现Harbor Registry的高可用方案 陈实 张海宁 不久前,VMware发布了Docker容器数据卷的驱动(Docker Volume Driver for vSphere)1.0 beta版本,使得Docker宿主机能够直接在...

project_harbor
2016/10/09
300
0
使用harbor配置docker registry

前面连说了几篇与kubernetes相关的内容,这篇我们来说说docker registry。docker的registry与kubernetes本身并没有太直接的关系。但是任何使用到docker的地方,总少不了这玩艺儿。所以这篇博...

msj0905
06/27
0
0

没有更多内容

加载失败,请刷新页面

加载更多

Linux学习-1031(rsync同步工具 上)

10.28 rsync工具介绍 10.29/10.30 rsync常用选项 10.31 rsync通过ssh同步 一、 rsync工具介绍 rsync是一个同步工具,在日常的运维中常会用到。它可以本地同步,也实现可以远程两台机器同步。...

wxy丶
2分钟前
0
0
python实战一期:第一天

1. 为什么学习python 1.1 为什么要学Python? Python第一是个非常牛B的脚本语言,能满足绝大部分自动化运维的需求,又能做后端C/S架构,又能用WEB框架快速开发出高大上的Web界面,只有当你自...

laoba
4分钟前
0
0
Java并发编程学习三:线程同步的关键字以及理解

上篇文章中介绍了Java线程的带来的问题与内存模型中介绍了线程可能会引发的问题以及对应Java的内存模型,顺带介绍了Volatile和Sychronized关键字。今天对Java中涉及到的常见的关键类和关键字...

JerryLin123
10分钟前
0
0
我用代码来给你们分析一个赚钱的技巧

赚钱是个俗气的话题,但又是人人都绕不开的事情。我今天来“科学”地触碰下这个话题。 谈赚钱,就会谈到理财、投资,谈到炒股。有这样一个笑话: 问:如何成为百万富翁? 答:带一千万进入股...

crossin
10分钟前
0
0
spring MatchingBean应用

1、编写接口FactoryList import java.util.List;public interface FactoryList<E extends MatchingBean<K>, K> extends List<E> { E getBean(K factor); List<E> getBeanLi......

重城重楼
24分钟前
1
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部