本机环境(必须在有外网的环境下,网速需好)
centos7
Docker-ce
Docker-compose
Harbor
https://www.cnblogs.com/fat-girl-spring/p/13398538.html
修改/usr/lib/systemd/system/docker.service文件,在里面修改ExecStart那一行,增加--insecure-registry=192.168.113.129(harborIP地址),然后重启docker (systemctl daemon-reload systemctl restart docker)
yum install epel-release yum install docker-compose yum install -y python-pip docker-compose -version 查看docker-compose 版本号
Harbor下载网站https://github.com/goharbor/harbor/releases
获取软件包 Wget https://storage.googleapis.com/harbor-releases/release-1.7.0/harbor-online-installer-v1.7.5.tgz 解压软件包 tar -zxvf harbor-online-installer-v1.7.5.tgz 修改配置文件 cd harbor vi harbor.cfg ## Configuration file of Harbor # hostname设置访问地址,可以使用ip、域名,不可以设置为127.0.0.1或localhost hostname = 192.168.113.129 # 访问协议,默认是http,也可以设置https,如果设置https,则nginx ssl需要设置on ui_url_protocol = http # mysql数据库root用户默认密码root123,实际使用时修改下 db_password = root123 max_job_workers = 3 customize_crt = on ssl_cert = /data/cert/server.crt ssl_cert_key = /data/cert/server.key secretkey_path = /data admiral_url = NA # 邮件设置,发送重置密码邮件时使用 email_identity = email_server = smtp.mydomain.com email_server_port = 25 email_username = sample_admin@mydomain.com email_password = abc email_from = admin <sample_admin@mydomain.com> email_ssl = false # 启动Harbor后,管理员UI登录的密码,默认是Harbor12345 harbor_admin_password = Harbor12345 # 认证方式,这里支持多种认证方式,如LADP、本次存储、数据库认证。默认是db_auth,mysql数据库认证 auth_mode = db_auth # LDAP认证时配置项 #ldap_url = ldaps://ldap.mydomain.com #ldap_searchdn = uid=searchuser,ou=people,dc=mydomain,dc=com #ldap_search_pwd = password #ldap_basedn = ou=people,dc=mydomain,dc=com #ldap_filter = (objectClass=person) #ldap_uid = uid #ldap_scope = 3 #ldap_timeout = 5 # 是否开启自注册 self_registration = on # Token有效时间,默认30分钟 token_expiration = 30 # 用户创建项目权限控制,默认是everyone(所有人),也可以设置为adminonly(只能管理员) project_creation_restriction = everyone verify_remote_cert = on
配置完成之后再当前目录下执行./prepare,再执行./install.sh。Harbor就回根据当前目录下的docker-compose.yml下载依赖的镜像
登录用户为admin 密码默认为Harbor12345
docker login 192.168.113.129登陆,结果报错,
Error response from daemon: Get https://192.168.0.6/v1/users/: dial tcp 192.168.113.129:443: getsockopt: connection refused
最终解决方案如下:
A:在需要登陆的docker client端修改/usr/lib/systemd/system/docker.service文件,在里面修改ExecStart那一行,增加--insecure-registry=192.168.113.129,然后重启docker (systemctl daemon-reload systemctl restart docker)
修改后登录成功如下:
docker login 192.168.113.129
Username:admin
Password:Harbor12345
Login Succeeded
原文:https://www.cnblogs.com/fat-girl-spring/p/13405629.html