一直学一直嗨,一直嗨一直学

CentOS 7安装Harbor Docker Registry

文章目录

[隐藏]

  • 安装docker-compose
  • 开始安装harbor
  • 安装完毕后使用docker-compose查看
  • harbor的关闭和启动

Harbor是VMware公司开源的企业级Docker Registry,在原生Docker Registry的基础上增加了一些安全、访问控制、管理等功能以满足企业对于镜像仓库的需求。Harbor以docker-compose的规范形式组织各个组件,并通过docker-compose工具进行启停。

安装docker-compose
[root@node1 /root/harbor]#curl -L https://github.com/docker/compose/releases/download/1.13.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose  [root@node1 /root/harbor]#chmod +x /usr/local/bin/docker-compose  [root@node1 /root/harbor]#docker-compose version  docker-compose version 1.13.0, build 1719ceb  docker-py version: 2.2.1  CPython version: 2.7.13  OpenSSL version: OpenSSL 1.0.1t  3 May 2016  

修改harbor.cfg配置文件里的hostname参数为本机ip

hostname = 172.172.20.33  
开始安装harbor
[root@node1 /root/harbor]#./install.sh    [Step 0]: checking installation environment …    Note: docker version: 1.12.6    Note: docker-compose version: 1.13.0    [Step 1]: loading Harbor images …  dd60b611baaa: Loading layer [==================================================>] 133.2 MB/133.2 MB  0bfc226dc2e8: Loading layer [==================================================>] 1.536 kB/1.536 kB  66c3231118d2: Loading layer [==================================================>] 17.69 MB/17.69 MB  fe2c778bb727: Loading layer [==================================================>] 17.69 MB/17.69 MB  Loaded image: vmware/harbor-jobservice:v1.1.2                                   ] 196.6 kB/17.69 MB  fe4c16cbf7a4: Loading layer [==================================================>] 128.9 MB/128.9 MB  c4a8b7411af4: Loading layer [==================================================>] 60.57 MB/60.57 MB  3f117c44afbb: Loading layer [==================================================>] 3.584 kB/3.584 kB  3569f62067e2: Loading layer [==================================================>] 17.86 MB/17.86 MB  Loaded image: vmware/nginx:1.11.5-patched                                       ] 196.6 kB/17.86 MB  Loaded image: photon:1.0  4a050fccec52: Loading layer [==================================================>] 12.16 MB/12.16 MB  d918d73369ec: Loading layer [==================================================>]  17.3 MB/17.3 MB  22898836924e: Loading layer [==================================================>] 15.87 kB/15.87 kB  Loaded image: vmware/notary-photon:server-0.5.0                                 ]    512 B/15.87 kB  a39bd6a7f897: Loading layer [==================================================>] 10.95 MB/10.95 MB  6f79b8337a1f: Loading layer [==================================================>]  17.3 MB/17.3 MB  74bbd0e81dd0: Loading layer [==================================================>] 15.87 kB/15.87 kB  Loaded image: vmware/notary-photon:signer-0.5.0                                 ]    512 B/15.87 kB  2df722677b4c: Loading layer [==================================================>] 7.062 MB/7.062 MB  e5338f288c70: Loading layer [==================================================>] 7.062 MB/7.062 MB  Loaded image: vmware/harbor-adminserver:v1.1.2                                  ]  98.3 kB/7.062 MB  b79e6c985050: Loading layer [==================================================>] 21.26 MB/21.26 MB  568e827ac2db: Loading layer [==================================================>] 7.168 kB/7.168 kB  e120e08d1ae8: Loading layer [==================================================>] 12.92 MB/12.92 MB  c678c146825f: Loading layer [==================================================>] 9.728 kB/9.728 kB  835ee5702bce: Loading layer [==================================================>]  2.56 kB/2.56 kB  eaf7ac0e9e24: Loading layer [==================================================>] 21.26 MB/21.26 MB  Loaded image: vmware/harbor-ui:v1.1.2                                           ] 229.4 kB/21.26 MB  c8ef72937018: Loading layer [==================================================>] 67.93 MB/67.93 MB  01e57c31fb31: Loading layer [==================================================>] 3.584 kB/3.584 kB  ae8312f0516f: Loading layer [==================================================>] 3.072 kB/3.072 kB  47b646017cc6: Loading layer [==================================================>] 3.072 kB/3.072 kB  Loaded image: vmware/harbor-log:v1.1.2                                          ]    512 B/3.072 kB  5d6cbe0dbcf9: Loading layer [==================================================>] 129.2 MB/129.2 MB  435f2dfbd884: Loading layer [==================================================>] 344.6 kB/344.6 kB  814d7b59f0cc: Loading layer [==================================================>] 4.657 MB/4.657 MB  aae399245bd0: Loading layer [==================================================>] 1.536 kB/1.536 kB  21e2ae955f72: Loading layer [==================================================>] 33.84 MB/33.84 MB  a2d0f7b84059: Loading layer [==================================================>] 25.09 kB/25.09 kB  819fa6af55b8: Loading layer [==================================================>] 3.584 kB/3.584 kB  78914c99a468: Loading layer [==================================================>] 167.7 MB/167.7 MB  36e79c658afb: Loading layer [==================================================>] 6.144 kB/6.144 kB  f73503aca003: Loading layer [==================================================>] 9.216 kB/9.216 kB  a21b39f6da59: Loading layer [==================================================>] 1.536 kB/1.536 kB  2f0fcce131fa: Loading layer [==================================================>]  7.68 kB/7.68 kB  cbf999ad70ad: Loading layer [==================================================>] 4.608 kB/4.608 kB  8005207f317c: Loading layer [==================================================>] 4.608 kB/4.608 kB  Loaded image: vmware/harbor-db:v1.1.2                                           ]    512 B/4.608 kB  69c25b821c78: Loading layer [==================================================>] 22.79 MB/22.79 MB  5b403ac6f7ea: Loading layer [==================================================>] 3.584 kB/3.584 kB  9e2e304b5fe5: Loading layer [==================================================>] 2.048 kB/2.048 kB  Loaded image: vmware/registry:2.6.1-photon                                      ]    512 B/2.048 kB  78dbfa5b7cbc: Loading layer [==================================================>] 130.9 MB/130.9 MB  5f70bf18a086: Loading layer [==================================================>] 1.024 kB/1.024 kB  8deec01122be: Loading layer [==================================================>] 344.6 kB/344.6 kB  574ab36807f2: Loading layer [==================================================>] 1.536 kB/1.536 kB  d8f2cde2eef8: Loading layer [==================================================>] 20.48 kB/20.48 kB  eaa3924b054e: Loading layer [==================================================>]  5.12 kB/5.12 kB  8aa2c772121c: Loading layer [==================================================>] 184.3 MB/184.3 MB  c3014bbccb0b: Loading layer [==================================================>] 8.704 kB/8.704 kB  978a35efaa8c: Loading layer [==================================================>] 4.608 kB/4.608 kB  c2385ae7d6e5: Loading layer [==================================================>]  16.6 MB/16.6 MB  Loaded image: vmware/harbor-notary-db:mariadb-10.1.10                           ] 196.6 kB/16.6 MB      [Step 2]: preparing environment …  Generated and saved secret to file: /data/secretkey  Generated configuration file: ./common/config/nginx/nginx.conf  Generated configuration file: ./common/config/adminserver/env  Generated configuration file: ./common/config/ui/env  Generated configuration file: ./common/config/registry/config.yml  Generated configuration file: ./common/config/db/env  Generated configuration file: ./common/config/jobservice/env  Generated configuration file: ./common/config/jobservice/app.conf  Generated configuration file: ./common/config/ui/app.conf  Generated certificate, key file: ./common/config/ui/private_key.pem, cert file: ./common/config/registry/root.crt  The configuration files are ready, please use docker-compose to start the service.      [Step 3]: checking existing instance of Harbor …      [Step 4]: starting Harbor …  Creating network "harbor_harbor" with the default driver  Creating harbor-log …  Creating harbor-log … done  Creating harbor-db …  Creating harbor-adminserver …  Creating registry …  Creating harbor-db  Creating registry  Creating harbor-adminserver … done  Creating harbor-ui …  Creating harbor-ui … done  Creating nginx …  Creating harbor-jobservice …  Creating nginx  Creating harbor-jobservice … done    ✔ —-Harbor has been installed and started successfully.—-    Now you should be able to visit the admin portal at http://172.172.20.33.  For more details, please visit https://github.com/vmware/harbor .  
安装完毕后使用docker-compose查看
[root@node1 /root/harbor]#docker-compose ps         Name                     Command               State                                Ports  ——————————————————————————————————————————  harbor-adminserver   /harbor/harbor_adminserver       Up  harbor-db            docker-entrypoint.sh mysqld      Up      3306/tcp  harbor-jobservice    /harbor/harbor_jobservice        Up  harbor-log           /bin/sh -c crond && rm -f  …   Up      127.0.0.1:1514->514/tcp  harbor-ui            /harbor/harbor_ui                Up  nginx                nginx -g daemon off;             Up      0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp, 0.0.0.0:80->80/tcp  registry             /entrypoint.sh serve /etc/ …   Up      5000/tcp  

如果需要修改配置重新安装执行以下操作

docker-compose down -v  ./prepare  ./install.sh  
harbor的关闭和启动
[root@node1 /root/harbor]#docker-compose down -v  Stopping harbor-jobservice … done  Stopping nginx … done  Stopping harbor-ui … done  Stopping harbor-adminserver … done  Stopping registry … done  Stopping harbor-db … done  Stopping harbor-log … done  Removing harbor-jobservice … done  Removing nginx … done  Removing harbor-ui … done  Removing harbor-adminserver … done  Removing registry … done  Removing harbor-db … done  Removing harbor-log … done  Removing network harbor_harbor  [root@node1 /root/harbor]#  [root@node1 /root/harbor]#docker-compose ps  Name   Command   State   Ports  ——————————  [root@node1 /root/harbor]#  [root@node1 /root/harbor]#docker-compose up -d  Creating network "harbor_harbor" with the default driver  Creating harbor-log …  Creating harbor-log … done  Creating registry …  Creating harbor-adminserver …  Creating harbor-db …  Creating harbor-adminserver  Creating registry  Creating harbor-adminserver … done  Creating harbor-ui …  Creating harbor-ui … done  Creating nginx …  Creating harbor-jobservice …  Creating nginx  Creating harbor-jobservice … done  [root@node1 /root/harbor]#  [root@node1 /root/harbor]#docker-compose ps         Name                     Command               State                                Ports  ——————————————————————————————————————————  harbor-adminserver   /harbor/harbor_adminserver       Up  harbor-db            docker-entrypoint.sh mysqld      Up      3306/tcp  harbor-jobservice    /harbor/harbor_jobservice        Up  harbor-log           /bin/sh -c crond && rm -f  …   Up      127.0.0.1:1514->514/tcp  harbor-ui            /harbor/harbor_ui                Up  nginx                nginx -g daemon off;             Up      0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp, 0.0.0.0:80->80/tcp  registry             /entrypoint.sh serve /etc/ …   Up      5000/tcp  

通过浏览器访问harbor,默认用户名和密码是admin/Harbor12345

http://172.172.20.33

原文出处:zhongweicheng -> http://www.zhongweicheng.com/?p=3329

Tags: