Install Harbor mirror warehouse under CentOS
Need to rely on Python 2.7 or above, Docker engine 1.10 or above, and Docker Compose 1.6.0 or above.
Note: CentOS 7.2 comes with Python 2.7.5
Install Harbor
Download the offline installation package https://github.com/goharbor/harbor/releases
Unzip the installation package tar xvf harbor-offline-installer-v1.7.4.tgz
Modify the configuration file harbor.cfg
The required parameters are:
- hostname: The hostname of the target host, used to access the UI and register services. Cannot use localhost and 127.0.0.1, because harbor needs to be accessed by external clients, I changed it to an IP address here.
- ui_url_protocol: The protocol used to access the UI and token/notification service. The default is http. If SSL authentication is enabled on Nginx, it can be set to https. I used the default http here.
- max_job_workers: The maximum number of replicated workers in the job service. The default value is 50 here. Considering the performance of my server, I modified it to 5.
- customize_crt: set to on, the prepare script creates the private key and root certificate used to generate/verify the registry token. If set to off, the key and root certificate will be provided by an external source, and I set it to on.
- ssl_cert: The location of the SSL certificate. This property will only take effect when the protocol is set to https.
- ssl_cert_key: The location of the SSL key. This property will only take effect when the protocol is set to https.
- secretkey_path: The path where the password is stored, it is best not to modify it here, otherwise an error will be reported later, I modified it to /data/.
- log_rotate_count: The number of log files retained. After reaching the maximum value, previous logs will be deleted circularly.
- log_rotate_size: The size of each log. To save space, I set a maximum of 5 logs, each with a maximum of 200MB.
- db_password: The root password of the MySQL database used for DB authentication.
- harbor_admin_password: set the password of admin, the default is Harbor12345
Run prepare to update the parameters. /prepare
Start the installation, execute ./install.sh to install
After installation, visit http://ip
have a test
docker pull hello-world
docker tag hello-world xxx.xxx.xxx.xxx/library/hello-world
docker push xxx.xxx.xxx.xxx/library/hello-world
Please refer to http://www.ilkhome.cn/?post=450 for reporting port 443 issues
Push mirror failed, report denied: requested access to the resource is denied
Solution: In this case, log in to the harbor warehouse. If the login is successful, it will be OK.
docker login xxx.xxx.xxx.xxx
Username: admin
Password:
Login Succeeded
stop:
docker-compose -f docker-compose.yml stop
start up:
docker-compose -f docker-compose.yml start