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

How to build a Docker private image repository Harbor

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article focuses on "how to build a Docker private image repository Harbor". Friends who are interested may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to build a Docker private image warehouse Harbor".

1. Prepare before installation

Harbor GitHub Home Page https://github.com/goharbor/harbor

Download the latest release package, which is version 2.1.2 (about 500 MB), as shown below:

⚠ github downloads will be slow, you can use the github acceleration tool for download acceleration!

To install docker, you can view "CentOS installation Docker"

To install docker-compose, check out the installation tutorial https://docs.docker.com/compose/install on the official website.

# linux install docker-composesudo curl-L "https://github.com/docker/compose/releases/download/1.27.4/docker-compose-$(uname-s)-$(uname-m)"-o / usr/local/bin/docker-compose#! If the download is slow or cannot be downloaded [you can use github acceleration tools or methods] # modify docker-compose permissions sudo chmod + x / usr/local/bin/docker-compose# to establish a system soft connection sudo ln-s / usr/local/bin/docker-compose / usr/bin/docker-compose# verify whether the docker-compose version# output is as follows Then successfully install docker-compose version 1.27.4, build 40524192docker-py version: 4.3.1CPython version: 3.7.7OpenSSL version: OpenSSL 1.1.0l 10 Sep 20192, install Harbor

Extract the harbor package:

Tar-zxvf harbor-offline-installer-v2.1.2.tgz

Modify the configuration file:

# cd harbor/# lltotal 533416 root 9 17:19 common.sh-rw-r--r-- 1 root root 546180341 Dec 9 17:19 harbor.v2.1.2.tar.gz-rw-r--r-- 1 root root 8136 Dec 9 17:19 harbor.yml.tmpl-rwxr-xr-x 1 root root 2523 Dec 9 17:19 install.sh-rw-r--r-- 1 root root 11347 Dec 9 17:19 LICENSE-rwxr-xr-x 1 root root 1881 Dec 9 17:19 prepare# prepare configuration file # cp harbor.yml.tmpl harbor.yml# lscommon.sh harbor.v2.1.2.tar.gz harbor.yml harbor.yml.tmpl install.sh LICENSE prepare

Then modify the configuration file harbor.yml. [the new version of the configuration file has been changed from harbor.cfg to harbor.yml], as shown below:

Hostname: can be modified to IP or domain name, here it can be changed to native IP

Http.port: just change it to non-port 80, here it is 9200.

Harbor_admin_password:Harbor administrator password, modify as needed

Database.password:harbor database password, modify as needed

Https: comment out this section and enable http by default, unless you configure the https certificate

Execute installation command

. / install.sh

Output the following information:

[root@resources harbor] #. / install.sh [Step 0]: checking if docker is installed... Note: docker version: 20.10.1 [Step 1]: checking docker-compose is installed... Note: docker-compose version: 1.27.4 [Step 2]: loading Harbor images... Loaded image: goharbor/chartmuseum-photon:v2.1.2Loaded image: goharbor/prepare:v2.1.2Loaded image: goharbor/harbor-log:v2.1.2Loaded image: goharbor/harbor-registryctl:v2 .1.2Loaded image: goharbor/clair-adapter-photon:v2.1.2Loaded image: goharbor/harbor-db:v2.1.2Loaded image: goharbor/harbor-jobservice:v2.1.2Loaded image: goharbor/clair-photon:v2.1.2Loaded image: goharbor/notary-signer-photon:v2.1.2Loaded image: goharbor/harbor-portal:v2.1.2Loaded image: goharbor/redis-photon:v2.1.2Loaded image: goharbor/nginx-photon:v2.1.2Loaded image: goharbor/trivy-adapter- Photon:v2.1.2Loaded image: goharbor/harbor-core:v2.1.2Loaded image: goharbor/registry-photon:v2.1.2Loaded image: goharbor/notary-server-photon:v2.1.2 [Step 3]: preparing environment... [Step 4]: preparing harbor configs... prepare base dir is set to / opt/soft/harborWARNING:root:WARNING: HTTP protocol is insecure. Harbor will deprecate http protocol in the future. Please make sure to upgrade to httpsGenerated configuration file: / config/portal/nginx.confGenerated configuration file: / config/log/logrotate.confGenerated configuration file: / config/log/rsyslog_docker.confGenerated configuration file: / config/nginx/nginx.confGenerated configuration file: / config/core/envGenerated configuration file: / config/core/app.confGenerated configuration file: / config/registry/config.ymlGenerated configuration file: / config/registryctl/envGenerated configuration file: / config/registryctl/config.ymlGenerated configuration file: / config/ Db/envGenerated configuration file: / config/jobservice/envGenerated configuration file: / config/jobservice/config.ymlGenerated and saved secret to file: / data/secret/keys/secretkeySuccessfully called func: create_root_certGenerated configuration file: / compose_location/docker-compose.ymlClean up the input dir [Step 5]: starting Harbor... Creating network "harbor_harbor" with the default driverCreating harbor-log. DoneCreating registry... DoneCreating harbor-db... DoneCreating redis... DoneCreating registryctl... DoneCreating harbor-portal... DoneCreating harbor-core... DoneCreating harbor-jobservice... DoneCreating nginx... Done ✔-Harbor has been installed and started successfully.---- [root@resources harbor] #

⚠: after installation, the installation directory will look like this, as shown below:

You can see that there is an extra docker-compose.yml file, which is also based on the service orchestration file generated by harbor.yml for the docker-compose call to create the container.

3. Log in to Harbor

After the installation is completed, you can access the Harbor management console through the IP or domain name + port set in the configuration. If the port is occupied, you can go to the port mapping of the corresponding service in the harbor.yml file under the installation directory.

To test whether the installation is successful, log in to the console using the administrator password set in harbor.yml during installation and the user name admin:

Log in successfully and go to the home page, as shown below:

So far, Harbor has been built successfully!

At this point, I believe you have a better understanding of "how to build a Docker private image warehouse Harbor". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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