艺宵网 技术资讯 Harbor搭建及使用配置

Harbor搭建及使用配置

前置条件: docker 环境已安装完成 安装文件下载 https://github.com/goharbor…

前置条件:

docker 环境已安装完成

安装文件下载

https://github.com/goharbor/harbor/releases

上传到安装服务器中,并解压

tar xvf harbor-offline-installer-v2.1.2.tgz

拷贝harbor.yml.tmpl为 harbor.yml

cd harbor cp harbor.yml.tmpl harbor.yml

修改Harbor的配置文件harbor.yml,修改hostname,并注释掉https配置,相关属性说明参考注释即可;

# 指定Harbor的管理界面及镜像仓库访问地址
hostname: 192.168.3.101
# http相关配置
http:
  # http端口,如果配置了https,默认使用https
  port: 80
# https相关配置
#https:
#  # https端口
#  port: 443
#  # 指定Habor中Nginx的https的证书和私钥地址
#  certificate: /your/certificate/path
#  private_key: /your/private/key/path
# Harbor默认管理员账号admin的密码
harbor_admin_password: Harbor12345
# Harbor内置PostgreSQL数据库配置
database:
  # root用户密码
  password: root123
  # 最大空闲连接数,小于等于0表示无空闲连接
  max_idle_conns: 50
  # 最大连接数,小于等于0表示无限制
  max_open_conns: 100
# 默认数据目录
data_volume: /data
# Clair configuration
clair:
  # The interval of clair updaters, the unit is hour, set to 0 to disable the updaters.
  updaters_interval: 12
jobservice:
  # Maximum number of job workers in job service
  max_job_workers: 10
notification:
  # Maximum retry count for webhook job
  webhook_job_max_retry: 10
chart:
  # Change the value of absolute_url to enabled can enable absolute url in chart
  absolute_url: disabled
# 日志配置
log:
  # 日志级别配置: debug, info, warning, error, fatal
  level: info
  # 日志本地存储策略
  local:
    # 日志文件滚动数量,超过该数量会删除日志文件
    rotate_count: 50
    # 日志滚动大小,超过该大小会生成新的日志文件
    rotate_size: 200M
    # 日志存储路径
    location: /var/log/harbor
# This attribute is for migrator to detect the version of the .cfg file, DO NOT MODIFY!
_version: 1.10.0
# Configure proxies to be used by Clair, the replication jobservice, and Harbor. Leave blank if no proxies are required.
proxy:
  http_proxy:
  https_proxy:
  # no_proxy endpoints will appended to 127.0.0.1,localhost,.local,.internal,log,db,redis,nginx,core,portal,postgresql,jobservice,registry,registryctl,clair,chartmuseum,notary-server
  no_proxy:
  components:
    - core
    - jobservice
    - clair

验证环境

./prepare
prepare base dir is set to /data0/harbor/harbor
Unable to find image 'goharbor/prepare:v2.1.2' locally
v2.1.2: Pulling from goharbor/prepare
d92f685b57aa: Pull complete 
fc55d5d4818d: Pull complete 
ea8c2aea8e20: Pull complete 
3330770cd308: Pull complete 
c549bbd461f6: Pull complete 
df56c6333246: Pull complete 
ecedca2dfa64: Pull complete 
d3b48e96a07e: Pull complete 
Digest: sha256:d7959b235cbd0a357594d58c2341cb12788a388d7edacbad71095f3231cab4ca
Status: Downloaded newer image for goharbor/prepare:v2.1.2
WARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to https
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir

执行安装

./install.sh
Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.
To deploy your application across the swarm, use `docker stack deploy`.
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-portal ... done
Creating registry      ... done
Creating harbor-db     ... done
Creating redis         ... done
Creating registryctl   ... done
Creating harbor-core   ... done
Creating nginx             ... done
Creating harbor-jobservice ... done
✔ ----Harbor has been installed and started successfully.----

查看启动状态

docker ps
CONTAINER ID        IMAGE                                COMMAND                  CREATED             STATUS                             PORTS                       NAMES
729fac3898cc        goharbor/nginx-photon:v2.1.2         "nginx -g 'daemon of…"   27 seconds ago      Up 25 seconds (health: starting)   0.0.0.0:700->8080/tcp       nginx
4b78a495999f        goharbor/harbor-jobservice:v2.1.2    "/harbor/entrypoint.…"   27 seconds ago      Up 26 seconds (health: starting)                               harbor-jobservice
33d639cecdf1        goharbor/harbor-core:v2.1.2          "/harbor/entrypoint.…"   28 seconds ago      Up 27 seconds (health: starting)                               harbor-core
18f4f1afb0c1        goharbor/harbor-registryctl:v2.1.2   "/home/harbor/start.…"   29 seconds ago      Up 27 seconds (health: starting)                               registryctl
1b00b3b767e1        goharbor/registry-photon:v2.1.2      "/home/harbor/entryp…"   29 seconds ago      Up 27 seconds (health: starting)                               registry
8daec33ea75e        goharbor/harbor-db:v2.1.2            "/docker-entrypoint.…"   29 seconds ago      Up 27 seconds (health: starting)                               harbor-db
7b2ea6e5d4c1        goharbor/redis-photon:v2.1.2         "redis-server /etc/r…"   29 seconds ago      Up 28 seconds (health: starting)                               redis
481fff503e9f        goharbor/harbor-portal:v2.1.2        "nginx -g 'daemon of…"   29 seconds ago      Up 28 seconds (health: starting)                               harbor-portal
37c2e8e03514        goharbor/harbor-log:v2.1.2           "/bin/sh -c /usr/loc…"   30 seconds ago      Up 29 seconds (health: starting)   127.0.0.1:1514->10514/tcp   harbor-log

访问对应的IP地址

Harbor搭建及使用配置
本网站所收集的部分公开资料来源于互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。如果您发现网站上有侵犯您的知识产权的作品,请与我们取得联系,我们会及时修改或删除。http://www.yixao.net/tech/29672.html
Vedu

作者: Vedu

这个人很懒,什么都没有留下~

发表评论

联系我们

联系我们

15378714280

在线咨询: QQ交谈

邮箱: yixaonet@163.com

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部