首页 > 其他 > 详细

docker harbor

时间:2020-05-09 01:54:19      阅读:53      评论:0      收藏:0      [点我收藏+]

docker-harbor

1.docker register和docker harbor

docker harbor是在官方的register进行封装的因此也需要占用5000端口

  • docker register

1.界面功能简洁

2.用户权限划分不明显

3.清理历史镜像麻烦

  • docker harbor

1.界面友好

2.用户权限划分明显

3.删除镜像方便

4.可配置https 配置主从等

2.安装docker harbor

官方软件地址

安装前提: docker版本和docker-compose版本(harbor使用compose创建)

On a Linux host:** docker 17.06.0-ce+ and docker-compose 1.18.0+ .

版本:

harbor分为在线安装和离线安装 这里使用离线安装
技术分享图片

安装compose

#配置epel源下载docker-compose 
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum install -y docker-compose

上传 harbor-offline-installer-v1.5.1.tgz 的包并解压

[root@localhost ~]# tar xf harbor-offline-installer-v1.5.1.tgz 

修改配置文件

[root@localhost harbor]# vi harbor.cfg 

7:hostname = 192.168.100.2

68:harbor_admin_password = 123456

启动脚本

[root@localhost harbor]# ./install.sh 

[Step 0]: checking installation environment ...

Note: docker version: 18.09.6

Note: docker-compose version: 1.18.0

[Step 1]: loading Harbor images ...
52ef9064d2e4: Loading layer [==================================================>]  135.9MB/135.9MB
4a6862dbadda: Loading layer [==================================================>]  23.25MB/23.25MB
58b7d0c522b2: Loading layer [==================================================>]   24.4MB/24.4MB
9cd4bb748634: Loading layer [==================================================>]  7.168kB/7.168kB
c81302a14908: Loading layer [==================================================>]  10.56MB/10.56MB
7848e9ba72a3: Loading layer [==================================================>]  24.39MB/24.39MB
Loaded image: vmware/harbor-ui:v1.5.1
f1691b5a5198: Loading layer [==================================================>]  73.15MB/73.15MB
a529013c99e4: Loading layer [==================================================>]  3.584kB/3.584kB
d9b4853cff8b: Loading layer [==================================================>]  3.072kB/3.072kB
3d305073979e: Loading layer [==================================================>]  4.096kB/4.096kB
c9e17074f54a: Loading layer [==================================================>]  3.584kB/3.584kB
956055840e30: Loading layer [==================================================>]  9.728kB/9.728kB
Loaded image: vmware/harbor-log:v1.5.1
185db06a02d0: Loading layer [==================================================>]  23.25MB/23.25MB
835213979c70: Loading layer [==================================================>]   20.9MB/20.9MB
f74eeb41c1c9: Loading layer [==================================================>]   20.9MB/20.9MB
Loaded image: vmware/harbor-jobservice:v1.5.1
9bd5c7468774: Loading layer [==================================================>]  23.25MB/23.25MB
5fa6889b9a6d: Loading layer [==================================================>]   2.56kB/2.56kB
bd3ac235b209: Loading layer [==================================================>]   2.56kB/2.56kB
cb5d493833cc: Loading layer [==================================================>]  2.048kB/2.048kB
557669a074de: Loading layer [==================================================>]   22.8MB/22.8MB
f02b4f30a9ac: Loading layer [==================================================>]   22.8MB/22.8MB
Loaded image: vmware/registry-photon:v2.6.2-v1.5.1
5d3b562db23e: Loading layer [==================================================>]  23.25MB/23.25MB
8edca1b0e3b0: Loading layer [==================================================>]  12.16MB/12.16MB
ce5f11ea46c0: Loading layer [==================================================>]   17.3MB/17.3MB
93750d7ec363: Loading layer [==================================================>]  15.87kB/15.87kB
36f81937e80d: Loading layer [==================================================>]  3.072kB/3.072kB
37e5df92b624: Loading layer [==================================================>]  29.46MB/29.46MB
Loaded image: vmware/notary-server-photon:v0.5.1-v1.5.1
0a2f8f90bd3a: Loading layer [==================================================>]  401.3MB/401.3MB
41fca4deb6bf: Loading layer [==================================================>]  9.216kB/9.216kB
f2e28262e760: Loading layer [==================================================>]  9.216kB/9.216kB
68677196e356: Loading layer [==================================================>]   7.68kB/7.68kB
2b006714574e: Loading layer [==================================================>]  1.536kB/1.536kB
Loaded image: vmware/mariadb-photon:v1.5.1
a8c4992c632e: Loading layer [==================================================>]  156.3MB/156.3MB
0f37bf842677: Loading layer [==================================================>]  10.75MB/10.75MB
9f34c0cd38bf: Loading layer [==================================================>]  2.048kB/2.048kB
91ca17ca7e16: Loading layer [==================================================>]  48.13kB/48.13kB
5a7e0da65127: Loading layer [==================================================>]   10.8MB/10.8MB
Loaded image: vmware/clair-photon:v2.0.1-v1.5.1
0e782fe069e7: Loading layer [==================================================>]  23.25MB/23.25MB
67fc1e2f7009: Loading layer [==================================================>]  15.36MB/15.36MB
8db2141aa82c: Loading layer [==================================================>]  15.36MB/15.36MB
Loaded image: vmware/harbor-adminserver:v1.5.1
3f87a34f553c: Loading layer [==================================================>]  4.772MB/4.772MB
Loaded image: vmware/nginx-photon:v1.5.1
Loaded image: vmware/photon:1.0
ad58f3ddcb1b: Loading layer [==================================================>]  10.95MB/10.95MB
9b50f12509bf: Loading layer [==================================================>]   17.3MB/17.3MB
2c21090fd212: Loading layer [==================================================>]  15.87kB/15.87kB
38bec864f23e: Loading layer [==================================================>]  3.072kB/3.072kB
6e81ea7b0fa6: Loading layer [==================================================>]  28.24MB/28.24MB
Loaded image: vmware/notary-signer-photon:v0.5.1-v1.5.1
897a26fa09cb: Loading layer [==================================================>]  95.02MB/95.02MB
16e3a10a21ba: Loading layer [==================================================>]  6.656kB/6.656kB
85ecac164331: Loading layer [==================================================>]  2.048kB/2.048kB
37a2fb188706: Loading layer [==================================================>]   7.68kB/7.68kB
Loaded image: vmware/postgresql-photon:v1.5.1
bed9f52be1d1: Loading layer [==================================================>]  11.78kB/11.78kB
d731f2986f6e: Loading layer [==================================================>]   2.56kB/2.56kB
c3fde9a69f96: Loading layer [==================================================>]  3.072kB/3.072kB
Loaded image: vmware/harbor-db:v1.5.1
7844feb13ef3: Loading layer [==================================================>]  78.68MB/78.68MB
de0fd8aae388: Loading layer [==================================================>]  3.072kB/3.072kB
3f79efb720fd: Loading layer [==================================================>]   59.9kB/59.9kB
1c02f801c2e8: Loading layer [==================================================>]  61.95kB/61.95kB
Loaded image: vmware/redis-photon:v1.5.1
454c81edbd3b: Loading layer [==================================================>]  135.2MB/135.2MB
e99db1275091: Loading layer [==================================================>]  395.4MB/395.4MB
051e4ee23882: Loading layer [==================================================>]  9.216kB/9.216kB
6cca4437b6f6: Loading layer [==================================================>]  9.216kB/9.216kB
1d48fc08c8bc: Loading layer [==================================================>]   7.68kB/7.68kB
0419724fd942: Loading layer [==================================================>]  1.536kB/1.536kB
543c0c1ee18d: Loading layer [==================================================>]  655.2MB/655.2MB
4190aa7e89b8: Loading layer [==================================================>]  103.9kB/103.9kB
Loaded image: vmware/harbor-migrator:v1.5.0


[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/config.yml
Generated configuration file: ./common/config/log/logrotate.conf
Generated configuration file: ./common/config/jobservice/config.yml
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.
Creating harbor-log ... done

[Step 3]: checking existing instance of Harbor ...

Creating harbor-adminserver ... done
Creating harbor-ui ... done
Creating network "harbor_harbor" with the default driver
Creating harbor-jobservice ... done
Creating registry ... 
Creating harbor-adminserver ... 
Creating harbor-db ... 
Creating redis ... 
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.100.2. 
For more details, please visit https://github.com/vmware/harbor .

因为是http形式 使用需要修改daemon .json文件 添加信任

{
"insecure-registries": ["192.168.100.2"]
}

[root@localhost harbor]# systemctl restart docker

访问页面 192.168.100.2 默认用户为admin 密码为刚刚写的000000

上传下载操作按照提示即可

技术分享图片

测试 需要登入否则报错

denied: requested access to the resource is denied
[root@localhost harbor]# docker tag nginx:latest 192.168.100.2/library/nginx:v1
[root@localhost harbor]# docker login 192.168.100.2
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
[root@localhost harbor]# docker push 192.168.100.2/library/nginx:v1

密码存储于一下

[root@localhost harbor]# cat /root/.docker/config.json 
{
        "auths": {
                "192.168.100.2": {
                        "auth": "YWRtaW46MDAwMDAw"
                }
        },
        "HttpHeaders": {
                "User-Agent": "Docker-Client/18.09.6 (linux)"
        }

3.docker harbor配置https证书

配置证书

这里使用阿里云的证书 下载nginx的 并配置解析

技术分享图片
技术分享图片

修改配置文件

(因为证书问题 改为hsgoose.top这个了 影响不大)

hostname = hsgoose.top
ui_url_protocol = https
ssl_cert = /root/cert/3563773_hsgoose.top.pem
ssl_cert_key = /root/cert/3563773_hsgoose.top.key

修改脚本文件注释这一行 这样会块 因为前面导入了

[root@localhost harbor]# vim install.sh  

#       docker load -i ./harbor*.tar.gz

技术分享图片

docker harbor

原文:https://www.cnblogs.com/hsgoose/p/12853471.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!