一 简介
Harbor 是一个由 CNCF 托管的开源的 Docker 镜像仓库管理工具,我们可以通过它快速的建立起自己的私有仓库。 当然,搭建私有仓库的选择很多,如 Docker 官方提供的 registry 镜像或者 Nexus 等
二 安装
1 底层要求
- Python 2.7或更高版本,安装见我另一篇文章Linux ❉ CentOS 7安装Python3详解_wangjie72270的博客-优快云博客CentOS 7安装Python3详解
https://blog.youkuaiyun.com/wangjie72270/article/details/122140513?spm=1001.2014.3001.5501
- Docker 1.10或更高版本,安装见我另一篇文章(4条消息) Docker ❉ 基础知识与docker安装_wangjie72270的博客-优快云博客
https://blog.youkuaiyun.com/wangjie72270/article/details/102965865
- Docker Compose 1.6.0或更高版本,安装见我另一篇文章(4条消息) Docker ❉ Docker-Compose详解_wangjie72270的博客-优快云博客
https://blog.youkuaiyun.com/wangjie72270/article/details/122123256
Docker Compose下载URL:https://github.com/docker/compose/releases/
[root@localhost ~]# curl -L https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
[root@localhost ~]# chmod +x /usr/local/bin/docker-compose
检查部署底层要求版本是否符合
[root@localhost bin]# python --version
Python 3.8.0
# 加一条软链接以免报错
[root@localhost bin]# ln -s /usr/local/python3/bin/python3.8 /usr/bin/python3
[root@localhost bin]# python3 --version
Python 3.8.0
[root@localhost bin]# docker --version
Docker version 20.10.12, build e91ed57
[root@localhost bin]# docker-compose --version
docker-compose version 1.21.2, build a133471
2 安装Harbor
(1)获取文件
Harbor下载URL:https://github.com/goharbor/harbor/releases
点击此处进行跳转下载
# 我用的自己的harbor包,需要进行一下校验
[root@192 ~]# md5sum harbor-offline-installer-v1.10.1.tgz
e9ccca33e9a25b6b64425943c06f5fe6 harbor-offline-installer-v1.10.1.tgz
# 解压缩以后会出现一个harbor文件夹
[root@192 ~]# tar -zxf harbor-offline-installer-v1.10.1.tgz
[root@192 ~]# ll
total 658288
~~~
drwxr-xr-x 2 root root 118 Dec 25 03:44 harbor
-rw-r--r-- 1 root root 674078519 Dec 25 03:43 harbor-offline-installer-v1.10.1.tgz
~~~
(2)修改Harbor配置文件
[root@192 cert]# cd /root/harbor/
[root@192 harbor]# ll
total 662120
-rw-r--r-- 1 root root 3398 Feb 10 2020 common.sh
-rw-r--r-- 1 root root 677974489 Feb 10 2020 harbor.v1.10.1.tar.gz
-rw-r--r-- 1 root root 5882 Feb 10 2020 harbor.yml
-rwxr-xr-x 1 root root 2284 Feb 10 2020 install.sh
-rw-r--r-- 1 root root 11347 Feb 10 2020 LICENSE
-rwxr-xr-x 1 root root 1749 Feb 10 2020 prepare
# 这里有个harbor.yml
Harbor配置文件参数详解(重点)
[root@localhost harbor]# vim harbor.yml
# Configuration file of Harbor
# Harbor的配置文件
# The IP address or hostname to access admin UI and registry service.
# 配置访问管理UI和注册表服务的IP地址或主机名
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
# 不要使用localhost或127.0.0.1,因为Harbor需要被外部客户端访问
hostname: 192.168.247.132 # 虚拟机IP
-----------------------------------------------------------------------
# http related config
# http相关配置
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
# 若https端口开启,此端口重定向至https端口
port: 80
-----------------------------------------------------------------------
## https related config # 我选择注释掉,否则会报错
## https相关