其他分享
首页 > 其他分享> > 11.企业级仓库harbor搭建

11.企业级仓库harbor搭建

作者:互联网

1.在github下载源码包
[root@docker03 ~]# wget https://github.com/goharbor/harbor/releases/download/v1.10.0/harbor-offline-installer-v1.10.0.tgz
2.解压源码包
[root@docker03 ~]# tar xf harbor-offline-installer-v1.8.0.tgz 
[root@docker03 ~/harbor]# ls
harbor.v1.10.0.tar.gz  harbor.v1.8.0.tar.gz  harbor.yml  install.sh  LICENSE  prepare
3.配置harbor.yml文件
#修改域名,默认http,端口80

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 80
  
#设置初始账户admin的密码
# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password:123456

4.运行安装脚本(默认会启动很多容器,过程较慢 )
[root@docker03 ~/harbor]# sh install.sh 
5.测试

6.因为不是https,所以要添加信任
[root@docker03 ~]# cat /etc/docker/daemon.json
{
        "insecure-registries":["10.0.0.13:5000","10.0.0.13"]
}

[root@docker03 ~]# systemctl restart docker   #重启docker
7.登录harbor账号
[root@docker03 ~/harbor]# docker login 10.0.0.13
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
8.上传镜像测试
[root@docker03 ~/harbor]# docker push 10.0.0.13/shuai/centos:6.9 
The push refers to repository [10.0.0.13/shuai/centos]
aaa5621d7c01: Pushed 
6.9: digest: sha256:7e172600dff1903f186061ce5f5295664ec9942ca120e4e5b427ddf01bb2b35b size: 529

9.下载镜像测试(也需要登录)
[root@docker03 ~/harbor]# docker pull 10.0.0.13/shuai/centos:6.9 
6.9: Pulling from shuai/centos
Digest: sha256:7e172600dff1903f186061ce5f5295664ec9942ca120e4e5b427ddf01bb2b35b
Status: Image is up to date for 10.0.0.13/shuai/centos:6.9
10.0.0.13/shuai/centos:6.9
10.给harbor加https认证

10.1下载证书

10.2修改harbor.yml配置文件

hostname: fushuaizhang.cn
# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
#  port: 80

 https related config
 https:
#   # https port for harbor, default is 443
   port: 443
#   # The path of cert and key files for nginx
   certificate: /your/certificate/path   #证书路径
   private_key: /your/private/key/path   #秘钥路径

10.3运行安装脚本

sh install.sh

标签:11,10.0,harbor,企业级,https,docker03,root,port
来源: https://www.cnblogs.com/zhangfushuai/p/16370619.html