我是靠谱客的博主 风中寒风,最近开发中收集的这篇文章主要介绍2022-10-15 Docker Harbor安装harbor常见问题参考文章,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Docker Harbor安装

  • harbor
  • 常见问题
    • 上传下载镜像
    • 更新harbor配置
  • 参考文章

harbor

  1. github下载地址:自行选择版本进行下载 harbor-offline-installer-vx.x.x.tgz

前置需要docker、docker-compose这里不做介绍可看另一篇文章里有安装方法。

  1. 解压安装包
  2. 修改harbor安装的配置文件
# cp harbor.yml.tmpl
harbor.yml
# mkdir -p /opt/application/harbor
//用于存放harbor的持久化数据
harbor.yml配置文件主要修改参数如下:
hostname: 192.168.1.81
//设置访问地址,可以使用ip、域名,不可以设置为127.0.0.1或localhost。默认情况下,harbor使用的端口是80,若使用自定义的端口,除了要改docker-compose.yml文件中的配置外,这里的hostname也要加上自定义的端口,否则在docker login、push时会报错
#http配置
http:
# port for http, default is 80. If https enabled, this port will redirect to https port
port: 9999
#https配置(如不需要可不配置,注释掉)
# 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
#external_url: https://reg.mydomain.com:8433
//如果要启用外部代理,比如外层的NGINX、LB等,请取消注释external_url,当它启用时,hostname将不再使用。
harbor_admin_password: Harbor12345
//admin密码
#数据库配置
database:
# The password for the root user of Harbor DB. Change this before any production use.
password: root123
# The maximum number of connections in the idle connection pool. If it <=0, no idle connections are retained.
max_idle_conns: 50
# The maximum number of open connections to the database. If it <= 0, then there is no limit on the number of open connections.
# Note: the default number of connections is 100 for postgres.
max_open_conns: 100
#持久化数据目录
data_volume: /opt/docker/harbor/data
……
  1. 执行安装脚本
./install.sh

直接结束后即可通过 http://192.168.1.81:9999 admin Harbor12345访问

常见问题

上传下载镜像

  1. 先在配置/etc/docker/daemon.json中添加docker镜像仓库:

重启docker 服务

systemctl restart docker

  1. /etc/docker/daemon.json中添加:
{
"insecure-registries":["192.168.1.81:9999"]
}
  1. 上传镜像时先登录
docker login 192.168.1.81:9999
Username: admin
Password:
Error response from daemon: Get https://192.18.0.8:9999/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
  1. 推送镜像到仓库中
docker push 192.168.1.81:9999/image:tag

更新harbor配置

如果需要更改harbor的配置项,可按以下步骤进行修改更新

docker-compose down -v
vim /usr/local/harbor/harbor.yml
./prepare
docker-compose up -d

参考文章

harbor搭建及使用

Harbor 部署安装

最后

以上就是风中寒风为你收集整理的2022-10-15 Docker Harbor安装harbor常见问题参考文章的全部内容,希望文章能够帮你解决2022-10-15 Docker Harbor安装harbor常见问题参考文章所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(73)

评论列表共有 0 条评论

立即
投稿
返回
顶部