部署harbor

什么是 Harbor?

harbor 是 VMware 公司开源的企业级 DockerRegistry 项目,项目地址为 https://github.com/vmware/harbor。其目标是帮助用户迅速搭建一个企业级的 Docker registry 服务。它以 Docker 公司开源的 registry 为基础,提供了管理UI,基于角色的访问控制(Role Based Access Control),AD/LDAP集成、以及审计日志(Auditlogging) 等企业用户需求的功能,同时还原生支持中文。Harbor 的每个组件都是以 Docker 容器的形式构建的,使用 Docker Compose 来对它进行部署。

环境准备
1、腾讯云服务器(CentOS7.6)
2、Docker 版本:19.03.1
3、Docker-compose:1.24.1
4、Harbor:1.8.2

安装docker

1.较旧版本的Docker被称为docker或docker-engine。如果已安装这些,请卸载它们以及相关的依赖项。

$ sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

2.使用以下命令设置稳定存储库。

$ sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

3.安装最新版本的Docker Engine - 社区和容器,并启动。

sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker

安装docker-compose

1.运行此命令以下载Docker Compose的当前稳定版本

sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

2.对二进制文件应用可执行权限

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

配置harbor

[https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md]
(https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md)参考文档
将下载好的harbor压缩包解压

tar xf harbor-offline-installer-v1.8.2.tgz  -C /usr/local/

到解压后harbor文件目录下,修改配制文件(根据官方文档进行修改)

vim harbor.yml

执行install.sh,自动检测环境,生成docker-compose文件,搭建harbor环境

./install.sh 

反馈信息


[Step 2]: preparing environment ...
prepare base dir is set to /usr/local/harbor
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /secret/keys/secretkey
Generated certificate, key file: /secret/core/private_key.pem, cert file: /secret/registry/root.crt
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir



[Step 3]: starting Harbor ...
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating registryctl ... done
Creating harbor-db   ... done
Creating redis       ... done
Creating registry    ... done
Creating harbor-core ... done
Creating harbor-portal     ... done
Creating harbor-jobservice ... done
Creating nginx             ... done

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

Now you should be able to visit the admin portal at http://www.lvxin.xyz. 
For more details, please visit https://github.com/goharbor/harbor .

测试

打开浏览器输入搭建harbor的服务器ip


image.png

输入用户名密码后进入(默认为admin/Harbor12345)


image.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容