离线安装Harbor

安装配置Harbor

  • 下载离线安装包

https://github.com/goharbor/harbor/releases/download/v2.5.3/harbor-offline-installer-v2.5.3.tgz

  • 解压到opt目录下
1
tar -xvf harbor-offline-installer-v2.5.3.tgz
  • 拷贝配置文件

修改Hostname,http.port,注释掉https

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Configuration file of Harbor

# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 10.0.0.3 # 应该填写外网地址

# http related config
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 8089

# https related config
#https:
# # https port for harbor, default is 443
# port: 443
# # The path of cert and key files for nginx
# certificate: /your/certificate/path
# private_key: /your/private/key/path

# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
# external_url: https://reg.mydomain.com:8433

# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: xxxxxxx
  • 执行安装脚本

安装Harbor前要先安装docker

1
2
3
4
5
# 安装环境
./prepare

#安装Harbor
./install.sh

基本使用方法

  • docker配置信任仓库
1
2
3
4
5
6
7
# /etc/docker/daemon.json
"insecure-registries": ["10.0.0.3:8777"]

# 重启docker

systemctl daemon-reload
systemctl restart docker
  • 重启Harbor
1
2
3
docker-compose down

docker-compose up -d
  • docker登录Harbor
1
docker login 10.0.0.3:8777
  • docker推送命令
1
2
3
4
# 在项目中标记镜像
docker tag SOURCE_IMAGE[:TAG] 10.0.0.3:8777/demo/REPOSITORY[:TAG]
# 推送镜像到当前项目
docker push 10.0.0.3:8777/demo/REPOSITORY[:TAG]
1
2
3
4
# 在项目中标记镜像
docker tag k8s.gcr.io/kube-scheduler:v1.22.17 10.0.0.3:8777/demo/kube-scheduler:v1.22.17
# 推送镜像到当前项目
docker push 10.0.0.3:8777/demo/kube-apiserver:v1.22.17


离线安装Harbor
https://blog.erhuoyan.cn/2024/07/30/5bbd0d127d9c/
作者
erhuoyan
发布于
2024年7月30日
许可协议