www.icesr.com
IT运维工程师的摇篮

docker私有仓库之Harbor搭建

1、安装docker-compose
$ yum -y install epel-release
$ yum -y install python-pip

$ pip install docker-compose
$ docker-compose version
报错如下:
Traceback (most recent call last):
File “/usr/bin/docker-compose”, line 5, in
from pkg_resources import load_entry_point
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 3011, in

parse_requirements(__requires__), Environment()
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 626, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: backports.ssl-match-hostname>=3.5
解决办法:
$ pip install backports.ssl_match_hostname –upgrade

#再次确认就OK咯!
$ docker-compose version
docker-compose version 1.9.0, build 2585387
docker-py version: 1.10.6
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013

2、安装harbor
$ wget https://github.com/vmware/harbor/releases/download/0.5.0/harbor-offline-installer-0.5.0.tgz

$ tar xvf harbor-online-installer-0.5.0.tgz
$ cd harbor

#将配置文件harbor.cfg中的hostname修改如下,其它可参照官网修改https://github.com/vmware/harbor/blob/master/docs/installation_guide.md
hostname = 192.168.70.110

#执行安装
$ ./install.sh
……
Creating network “harbor_default” with the default driver
Creating harbor-log
Creating harbor-db
Creating registry
Creating harbor-ui
Creating harbor-jobservice
Creating nginx
✔ —-Harbor has been installed and started successfully.—-
Now you should be able to visit the admin portal at http://192.168.70.111.
For more details, please visit https://github.com/vmware/harbor .
You have new mail in /var/spool/mail/root
#这样就安装完成了

3、登录系统
http://192.168.70.110
user:admin
passwd:Harbor12345

4、push 和 pull 镜像
#centos打一个标签
docker tag centos:latest 192.168.70.110/library/centos:v1.0
#push到harbor中
docker push 192.168.70.110/library/centos:v1.0
报错1:
The push refers to a repository [192.168.70.110:80/library/centos]
Get https://192.168.70.110:80/v1/_ping: http: server gave HTTP response to HTTPS client
解决办法:需要指定使用http协议连接harbor
#如果安装的docker是docker engine(在节点服务器新建文件并指明harbor服务器信息如下):
cat >>/etc/docker/daemon.json< 报错2:
The push refers to a repository [192.168.70.110/library/centos]
97ca462ad9ee: Preparing
unauthorized: authentication required
解决办法:需要先登录才能push镜像
$ docker login -u admin -p Harbor12345 192.168.70.110
$ docker push 192.168.70.110/library/centos:v1.0
或者
$ docker login -u admin -p Harbor12345 192.168.70.110&& docker push 192.168.70.110/library/centos:v1.0

#这样上传成功之后在harbor的web界面就能看见上传到library项目中的centos镜像了

#创建项目、创建用户已经对项目授权不在赘述,因比较简单可自行研究。

未经允许不得转载:冰点网络 » docker私有仓库之Harbor搭建

分享到:更多 ()

评论 抢沙发

评论前必须登录!