Linux installation mirror warehouse Harbor

Let’s take a look at Harbor’s page first. Whether it’s page layout or operation function, it’s obviously better than registry.

 1. Install docker
docker installation

2. Installing docker-compse
Harbor requires the version of docker-compse, which I remember is higher than version 1.19. The installation of version 1.25 is provided here.

curl -L https://dn-dao-github-mirror.daocloud.io/docker/compose/releases/download/1.25.4/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
 
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version

 
3. Install Harbor
# Get the installation package
wget https://github.com/goharbor/harbor/releases/download/v2.4.0/harbor-online-installer-v2.4.0.tgz
 
# Unzip
tar -xf harbor-online-installer -v2.4.0.tgz -C /opt
cp /opt/harbor/harbor.yml.tmpl /opt/harbor/harbor.yml
 
# Modify the harbor.yml file
cd /opt/harbor/
vi harbor.yml

# Harbor's default password is Harbor12345, which can also be modified in the harbor.yml configuration file.
 
# run
./prepare
./install.sh

 
4. Access
IP+port number.

Account admin, password Harbor12345

 5. Simply do a push operation
First create a new test project on the Harbor management page

And there is a push command here.

 Server preparation (I used two machines here, if not, you can use the same machine where Harbor is located. The main operation is to push the mirror image to the mirror warehouse):

10.159.62.232: The machine where the Harbor mirror warehouse is located
10.159.62.214: The test machine

Start push (the test in the command below refers to the test we just created. If you create other projects, just replace them):

Operation on machine 214:
docker pull java:8
docker tag java:8 10.159.62.232:5000/test/java:8
docker push 10.159.62.232:5000/test/java:8

The first push error:

 solution:

Modify the daemon.json file of the 214 machine, copy the following content into it
vi /etc/docker/daemon.json
 
{   "registry-mirrors":["https://docker.mirrors.ustc.edu.cn"],   "insecure -registries": [     "10.159.62.232:5000"   ] }




The second push reports an error:

 solution:

#Log in to docker on machine 214 to connect to 232, and the account password is Harbor's account password.
docker login 10.159.62.232:5000
 
# Push again after successful login.

Remarks: In addition, if you have built the Jenkins+svn+docker continuous basic environment, the first push when using this mirror warehouse will also report the error of my second push above.

solution:

# Just log in on the host where Harbor is built. The account password is the account password of Harbor.
docker login 10.159.62.232:5000

 
6. Operation steps for modifying the configuration file and making it effective
1. Create the Harbor directory
2. Modify the harbor.yml file
3./prepare
4 docker-compose donw -v
5 docekr-compose up -d

 
7. Harbor boots up automatically
#Edit harbor.service, copy the following content into
vi /lib/systemd/system/harbor.service

[Unit]
Description=Harbor
After=docker.service systemd-networkd.service systemd-resolved.service
Requires=docker.service
Documentation=http://github.com/vmware/harbor
 
[Service]
Type=simple
Restart=on-failure
RestartSec=5
ExecStart=/usr/local/bin/docker-compose -f  /opt/harbor/docker-compose.yml up
ExecStop=/usr/local/bin/docker-compose -f /opt/harbor/docker-compose.yml down
 
[Install]
WantedBy=multi-user.target

# Start the harbor.service file to make it take effect
systemctl enable harbor
systemctl start harbor
——————————————————
Copyright Notice: This article is the original article of CSDN blogger "Prince of Cloud Village", follow CC 4.0 BY-SA copyright agreement, please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/qq_41915325/article/details/126873420

Guess you like

Origin blog.csdn.net/txl910514/article/details/131870300