Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The most detailed construction of Harbor image warehouse

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Harbor architecture:

As shown above, Harbor consists of six components:

Proxy (proxy server): Harbor components, such as register,UI and token services, are at the back end of the proxy service, and the proxy returns traffic from the client and browser to each back-end service.

Register (warehouse): responsible for storing Docker Images and processing docker pull/push commands. Harbor enforces control over access to the images, and register boots the client to the token service to obtain a valid token for each push and pull request.

Core services (Core Services): Harbor core functions, mainly providing the following services:

UI (graphical user interface): helps users manage image on register. Webhook is a mechanism configured in the registry so that image state changes in the registry can be populated to the Webhook endpoint of Harbour. Harbor uses webhook to update logs, initiate replication, and other functions. Token service: responsible for issuing tokens for each Docker push / pull command based on the user's project role. If there is no token in the request sent from the Docker client, the registry redirects the request to the token service. Database: the database stores metadata for projects, users, roles, replication strategies, and images.

Job services (Job service): for Images replication, you can synchronize local images to other Harbor instances.

Log collector (log collector): responsible for collecting logs from other modules in one place.

Build the environment and deploy:

# # installation of basic environment:

Wget-O / etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

Wget-O / etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

Yum remove-y docker docker-common docker-selinux docker-engine

Yum install-y yum-utils device-mapper-persistent-data lvm2

Yum-config-manager-- add-repo https://download.docker.com/linux/centos/docker-ce.repo

Yum-config-manager-enable docker-ce-edge

Yum-config-manager-enable docker-ce-test

Yum list docker-ce-- showduplicates | sort-r | grep stable

Docker installation:

Yum install-y docker-ce-18.06.2.ce

Configure Ali Cloud acceleration

Install version 1.24.0

Curl-L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname-s-uname-M`-o / usr/local/bin/docker-compose

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

Harbor offline installation 1.5.0 [http://harbor.orientsoft.cn/]

# the installation package has been downloaded locally and can be uploaded and installed directly

Since the domain name is an intranet domain name, configure the hosts of the harbor server

Extract the offline installation harbor & & configure harbor startup file & & sh install.sh [install]

Tar-zxvf harbor-offline-installer-v1.5.0.tgz-C / usr/local/

Cd / usr/local/harbor & & vim harbor.cfg

Sh install.sh [installation]

Access to Harbor warehouse

Configure the image:

1) download a centos image

2) tag and upload to the warehouse

3) Verification

Centos renew a new image:

Docker tag centos hason.docker.com/tools/centos7.6

Docker push harbor warehouse issues:

Resolution process:

/ usr/local/harbor & & docker-compose down

Add the address of docker push image repository:

Generate https certificate

Mkdir-p / data/cert/

Openssl genrsa-out / data/cert/server.key 2048

Openssl req-x509-new-nodes-key / data/cert/server.key-subj "/ CN=hason.docker.com"-days 50000-out / data/cert/server.crt*

Mkdir-p / etc/docker/certs.d/hason.docker.com

Cp / data/cert/server.crt / etc/docker/certs.d/hason.docker.com/

Systemctl restart docker

/ usr/local/harbor & & docker-compose up-d

Docker login hason.docker.com [use harbor user + password to log in to the repository]

Log in to harbor Web to verify:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report