Skip to content

Установка harbor

Шаг 1: Подготовка окружения

Для начала создадим директорию и загрузим установщик Harbor:

sudo mkdir -p /srv/docker && cd /srv/docker/
sudo wget https://github.com/goharbor/harbor/releases/download/v2.10.0/harbor-online-installer-v2.10.0.tgz
tar xvzf harbor-online-installer-v2.10.0.tgz
cd harbor
cp harbor.yml.tmpl harbor.yml
vim harbor.yml

Шаг 2: Редактирование файла конфигурации

Откройте файл harbor.yml и внесите следующие изменения:

hostname: harbor-domain.ru
http:
    port: 8081
    relativeurls: true
external_url: https://harbor-domain.ru
и закомментировать любой код указывающий на https, потому что терминировать tls будем на traefik

# 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: registry.yourdomain.me

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

# 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 following will enable tls communication between all harbor components
# internal_tls:
#   # set enabled to true means internal tls is enabled
#   enabled: true
#   # put your cert and key files on dir
#   dir: /etc/harbor/tls/internal

# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
external_url: https://registry.yourdomain.me

# 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: changeme

# Harbor DB configuration
database:
  # The password for the root user of Harbor DB. Change this before any production use.
  password: changeme
  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 1024 for postgres of harbor.
  max_open_conns: 1000

Шаг 3: Добавление конфигурации для хранения в S3

Если вы планируете использовать хранилище S3 для данных, добавьте следующие строки в файл harbor.yml:

data_volume: /data
storage_service:
  s3:
    regionendpoint: storage.yandexcloud.net
    region: ru-central1
    bucket: harborr
    accesskey: ...
    secretkey: ...

Шаг 4: Запуск установки

Запускаем установку Harbor с интеграцией Trivy (инструмент для сканирования уязвимостей): ./install.sh --with-trivy

После того как harbor был установлен, не возможно будет сделать docker login под тем пользователем. Если мы создадим тестового пользователя и потом удалим, то мы не сможем переключиться на OIDC based login, поэтому переходим к настройке OIDC keycloak если он у вас уже настроен.

  • LDAP integration
  • https://computingforgeeks.com/harbor-registry-ldap-integration/
  • https://itproblog.ru/реестр-контейнеров-harbor-установка/
  • https://habr.com/ru/companies/first/articles/706774/