Skip to content

使用docker离线部署单机harbor

Published:

1.下载离线安装包并解压

安装包下载地址
https://github.com/goharbor/harbor/releases

# 下载离线安装包
wget https://github.com/goharbor/harbor/releases/download/v2.7.3/harbor-offline-installer-v2.7.3.tgz
# 解压
tar xzvf harbor-offline-installer-v2.7.3.tgz

2.修改配置文件

cd harbor
cp harbor.yml.tmpl harbor.yml
vi harbor.yml

# 修改配置文件中的域名,证书,admin的初始密码
hostname: yourdomain.com
http:
  port: 80
https:
  port: 443
  certificate: /data/harbor/ssl/yourdomain.com.pem
  private_key: /data/harbor/ssl/yourdomain.com.key
harbor_admin_password: yourpassword

3.运行安装脚本

sudo ./install.sh

脚本运行成功后即可登录

4.使用 harbor

登录harbor后创建新项目:
myproject

docker login yourdomain.com
docker push yourdomain.com/myproject/myimage[:tag]
docker pull yourdomain.com/myproject/myimage[:tag]