VMWare Harbor搭建手册

1.    环境准备

搭建使用虚拟机,所装操作系统是Centos7,以下是安装的软件和版本需求

Docker: Version >= 1.10.0

Docker-compse: Version >= 1.6.0

Harbor: Version 1.2.2

2.搭建过程

(1)Docker安装

yum安装 yum install docker

(2)Docker-compose安装

a) 拷贝docker-compose-Linux-x86_64到/usr/local/bin目录下

b) 对二进制文件赋可执行权限

chmod +x /usr/local/bin/docker-compose

c) 测试下是否安装成功

docker-compose –version

(3)Harbor搭建

a)下载Harbor离线安装包(具体文件参照上层目录 harbor-offline-installer-v1.2.2.tgz),将文件拷贝至虚拟机,并解压

tar xvf harbor-offline-installer-v1.2.2.tgz

b) 配置Harbor

解压之后,目录下会生成harbor文件夹,进入文件夹中修改harbor.cfg文件,将hostname修改为虚拟机ip地址

c)执行prepare脚本,创建docker-compose中需要的配置文件

./prepare

d)检查docker-compose.yml文件,检查所有容器中volumes对应的本地目录是否存在,如果不存在则手动创建

e) 执行安装脚本

./install.sh


[root@localhost harbor]# ./install.sh

[Step 0]: checking installation environment ...

Note: docker version: 1.10.3

Note: docker-compose version: 1.17.1

[Step 1]: loading Harbor images ...

[Step 2]: preparing environment ...

Clearing the configuration file: ./common/config/adminserver/env

Clearing the configuration file: ./common/config/ui/env

Clearing the configuration file: ./common/config/ui/app.conf

Clearing the configuration file: ./common/config/ui/private_key.pem

Clearing the configuration file: ./common/config/db/env

Clearing the configuration file: ./common/config/jobservice/env

Clearing the configuration file: ./common/config/jobservice/app.conf

Clearing the configuration file: ./common/config/registry/config.yml

Clearing the configuration file: ./common/config/registry/root.crt

Clearing the configuration file: ./common/config/nginx/nginx.conf

loaded secret from 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/app.conf

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.

[Step 3]: checking existing instance of Harbor ...

Note: stopping existing Harbor instance ...

[Step 4]: starting Harbor ...

Creating network "harbor_harbor" with the default driver

Creating harbor-log ...

Creating harbor-log ... done

Creating harbor-adminserver ...

Creating registry ...

Creating harbor-adminserver

Creating harbor-db ...

Creating registry

Creating registry ... done

Creating harbor-ui ...

Creating harbor-ui ... done

Creating harbor-jobservice ...

Creating nginx ...

Creating harbor-jobservice

Creating nginx ... done

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

Now you should be able to visit the admin portal athttp://100.2.104.51.

For more details, please visithttps://github.com/vmware/harbor.


f)查看是否所有容器都已经创建成功并处于UP状态

docker ps


VMWare Harbor搭建手册_第1张图片

如果有容器不是状态不是UP,则没有搭建成功,需要从步骤e)重新开始

g)访问Harbor

访问http://100.2.104.51,页面如下


VMWare Harbor搭建手册_第2张图片

你可能感兴趣的:(VMWare Harbor搭建手册)