当前位置:网站首页>Harbor image warehouse construction

Harbor image warehouse construction

2022-07-05 11:22:00 Ji Songsong

Harbor Image warehouse construction

1、 Install the underlying requirements

  • ​ Python Should be 2.7 Or later
  • ​ Docker Engine should be 1.10 Or later
  • ​ DockerCompose Need to be for 1.6.0 Or later

2、Harbor install

Harbor Official address :

​ https://github.com/vmware/harbor/releases

To configure harbor.yml

$ tar -zxvf harbor-online-installer-v2.5.2.tgz  # With online installation 
$ cd harbor && vim harbor.yml
...
hostname: harbor.registry.com  # The host name or fully qualified domain name of the target 
http:                          # Default http agreement , If https It works , Can automatically jump https
  port: 80                     # External access port 

#https: #https If you need a certificate, you can comment first 
# port: 443 
# certificate: /your/certificate/path # Certificate storage path 
# private_key: /your/private/key/path # Private key storage path 
...
harbor_admin_password: Harbor12345  # Sign in harbor Default password 
database:
  password: root123  # Database default connection password 
....
data_volume: /data   # Set up Harbor Data storage directory 
...
log:                 # Set log related information 
  level: info        # Set the log level 
  local:
    rotate_count: 50   # Number of logs reserved 
    rotate_size: 200M  # The size of each log 
    location: /var/log/harbor  # Log storage path 
    
$  ./install.sh
[Step 4]: starting Harbor ...
.....
 ----Harbor has been installed and started successfully.----  # Indicates successful build 

Log in using the command line Harbor, And upload and download images

 because docker By default, the pull image is https agreement , We need to be in /etc/docker/daemon.json Middle configuration insecure-registries.
{
    "insecure-registries": ["harbor.registry.com"] }

$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
170.18.9.141 harbor.registry.com

$ systemctl restart docker

$ docker login harbor.registry.com   # Log in to the warehouse , The certification information is retained in / Home directory /.docker/config.json In file 
Username: admin
Password: 
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
# Label the image as consistent with the warehouse image 
$ docker tag nginx:latest harbor.registry.com/library/nginx:v1 
# Push the mirror 
$ docker push harbor.registry.com/library/nginx:v1
The push refers to repository [harbor.registry.com/library/nginx]
e7344f8a29a3: Pushed 
44193d3f4ea2: Pushed 
41451f050aa8: Pushed 
b2f82de68e0d: Pushed 
d5b40e80384b: Pushed 
08249ce7456a: Pushed 
v1: digest: sha256:3536d368b898eef291fb1f6d184a95f8bc1a6f863c48457395aab859fda354d1 size: 1570

To configure Harbor Of HTTPS visit

Refer to the article in the stack self-control https certificate , After the certificate is generated , Put in harbor.yml In the configuration file certificate,private_key Under the path corresponding to the parameter .

原网站

版权声明
本文为[Ji Songsong]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207051118159448.html