Harbor安装及配置

时间:2024-01-29 13:25:39

安装步骤 

Harbor是一个用于存储和分发Docker镜像的企业级Registry服务器

Harbor机理:
    Harbor 是由 docker-compoe 启起来的一组 Docker Container
    其中nginx Container 负责整个 Harbor 的代理工作;
Harbor安装:
    1. Download the installer;    
    2. Configure harbor.yml; (配置文件用于Configuring Harbor)
    3. 执行install.sh来install and start Harbor;
    https://github.com/goharbor/harbor/blob/master/docs/installation_guide.md
    
Harbor启停:
    方式一:
        关闭harbor服务:docker-compose down -v
        修改配置文件:vim harbor.yml
        重新生成配置文件:./prepare或者或者bash prepare
        启动Harbor服务:docker-compose up -d
    方式二:
        修改配置文件:vim harbor.yml
        重新生成配置文件:./prepare或者或者bash prepare
        重启harbor:docker-compose down -v && docker-compose up -d

    注意:如果更改了harbor.yml文件,必须要重新执行install脚本,或者执行./prepare脚本,生成新的配置文件;
          

常用debug方式:
    docker info查看docker程序的配置信息
    docker-compose ps:查看harbor相关的容器信息
        
    
Harbor测试:
    登录仓库:docker login 127.0.0.1
        用户:test01 / ******; admin/Harbor12345
    镜像推送:docker push 192.168.16.128/library/IMAGE[:TAG]
    针对无证书harbor, 可以修改docker insecure-registry

安装提示信息

[Step 0]: checking installation environment ...

Note: docker version: 19.03.12

Note: docker-compose version: 1.27.3

[Step 1]: loading Harbor images ...
Loaded image: goharbor/chartmuseum-photon:v0.9.0-v1.9.3
Loaded image: goharbor/prepare:v1.9.3
Loaded image: goharbor/harbor-db:v1.9.3
Loaded image: goharbor/registry-photon:v2.7.1-patch-2819-2553-v1.9.3
Loaded image: goharbor/notary-signer-photon:v0.6.1-v1.9.3
Loaded image: goharbor/harbor-portal:v1.9.3
Loaded image: goharbor/redis-photon:v1.9.3
Loaded image: goharbor/harbor-migrator:v1.9.3
Loaded image: goharbor/harbor-log:v1.9.3
Loaded image: goharbor/nginx-photon:v1.9.3
Loaded image: goharbor/notary-server-photon:v0.6.1-v1.9.3
Loaded image: goharbor/clair-photon:v2.1.0-v1.9.3
Loaded image: goharbor/harbor-core:v1.9.3
Loaded image: goharbor/harbor-jobservice:v1.9.3
Loaded image: goharbor/harbor-registryctl:v1.9.3


[Step 2]: preparing environment ...
prepare base dir is set to /data/wyq/harbor/harbor
Clearing the configuration file: /config/log/logrotate.conf
Clearing the configuration file: /config/log/rsyslog_docker.conf
Clearing the configuration file: /config/nginx/nginx.conf
Clearing the configuration file: /config/core/env
Clearing the configuration file: /config/core/app.conf
Clearing the configuration file: /config/registry/config.yml
Clearing the configuration file: /config/registry/root.crt
Clearing the configuration file: /config/registryctl/env
Clearing the configuration file: /config/registryctl/config.yml
Clearing the configuration file: /config/db/env
Clearing the configuration file: /config/jobservice/env
Clearing the configuration file: /config/jobservice/config.yml
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /secret/keys/secretkey
Generated certificate, key file: /secret/core/private_key.pem, cert file: /secret/registry/root.crt
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir



[Step 3]: starting Harbor ...
Creating harbor-log ... done
Creating registry      ... done
Creating harbor-db     ... done
Creating harbor-portal ... done
Creating registryctl   ... done
Creating redis         ... done
Creating harbor-core   ... done
Creating harbor-jobservice ... done
Creating nginx             ... done

✔ ----Harbor has been installed and started successfully.----

Now you should be able to visit the admin portal at http://tim.harbor.com.
For more details, please visit https://github.com/goharbor/harbor .

 

参考:https://www.jianshu.com/p/fc544e27b507