关闭页面特效

Harbor部署(HTTP版)

1|0下载安装包


harbor 版本 下载需要的在线或离线安装包

  • 下载安装包

    以离线安装包为例

    wget https://github.com/goharbor/harbor/releases/download/v2.8.2/   harbor-offline-installer-v2.8.2.tgz
    
  • 解压

    tar -zxvf harbor-offline-installer-v2.8.2.tgz
    harbor/harbor.v2.8.2.tar.gz
    harbor/prepare
    harbor/LICENSE
    harbor/install.sh
    harbor/common.sh
    harbor/harbor.yml.tmpl
    

1|1修改harbor.yml


  • 修改文件名

    mv harbor.yml.tmpl harbor.yml
    
  • 编辑harbor.yml

    # 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: test.harbor.com   # 设置hostname
    
    # http related config
    http:
    # port for http, default is 80. If https enabled, this port will redirect to https port
    port: 80
    
    # https related config   #禁用https
    #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
    .......
    

1|2安装docker-compose


  • 下载docker-compose
    docker-compose版本下载对应的文件

    sudo curl -L "https://github.com/docker/compose/releases/download/1.25.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    
  • 给docker-compose执行权限

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

1|3部署Harbor


  • 运行脚本 prepare

    ./prepare
    
  • 运行脚本 install.sh 以安装Harbor

    ./instal.sh
    

1|4本地登录


  • 配置hosts文件即可实现本地登录

    vi /etc/hosts
    
    # 添加如下内容   部署harbor的服务器地址   harbor域名
    192.168.0.3  harbor.com
    
  • 登录

    用户名密码已在harbor.yml中设置,默认为admin/harbor12345
    
    docker login harbor.com
    
    Username: admin
    Password: 
    Error response from daemon: Get "https://test.harbor.com/v2/": dial tcp 192.168.0.4:443: connect: connection refused
    
    这个原因是访问 HTTPS 被拒绝(我们只配置了 HTTP),需要关闭安全验证。修改 /etc/docker/daemon.json
    
  • 修改 /etc/docker/daemon.json

     + "insecure-registries": ["test.harbor.com", "0.0.0.0"]
    
  • 重启 Docker

    sudo systemctl restart docker
    
  • 在安装 Harbor 的机器上重启 Harbor

     cd harbor
     docker-compose down -v
     docker-compose up -d
    
  • 登录

    docker login test.harbor.com
    Username: admin
    Password: 
    WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
    Configure a credential helper to remove this warning. See
    https://docs.docker.com/engine/reference/commandline/login/#credentials-store
    
    Login Succeeded
    

1|5WEB登录


harbor安装后,默认的端口是443,访问 https://localhost:80 即可登录,若是云服务器则需要做端口转发


__EOF__

作  者文十七
出  处https://www.cnblogs.com/sunshinefly/p/17713201.html
关于博主:编程路上的小学生,热爱技术,喜欢专研。评论和私信会在第一时间回复。或者直接私信我。
版权声明:署名 - 非商业性使用 - 禁止演绎,协议普通文本 | 协议法律文本
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!

posted @   文十七  阅读(50)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
0
0
关注
跳至底部
点击右上角即可分享
微信分享提示