Docker:企业级私有仓库harbor[十六]
一、安装配置
1、下载安装包
链接:https://pan.baidu.com/s/1Z9I7zYXSt-8ve3lFT2YCeg 提取码:iuqj
2、安装docker和docker-compose
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo yum install -y python2-pip pip install -i https://pypi.tuna.tsinghua.edu.cn/simple docker-compose
3、上传harbor-offline-installer-v1.5.1.tgz安装包到/opt,并解压
[root@luoahong opt]# pwd /opt [root@luoahong opt]# ll total 844664 drwx--x--x 4 root root 28 Jan 17 18:03 containerd drwxr-xr-x 4 root root 229 Jan 18 18:51 harbor -rw-r--r-- 1 root root 864933610 Jan 18 18:40 harbor-offline-installer-v1.5.1.tgz
4、修改harbor.cfg配置文件
hostname = 192.168.228.135 harbor_admin_password = 12345
5、执行install.sh
[root@luoahong harbor]# ./install.sh [Step 0]: checking installation environment ... Note: docker version: 18.09.1 Note: docker-compose version: 1.23.2 [Step 1]: loading Harbor images ... 52ef9064d2e4: Loading layer [==================================================>] 135.9MB/135.9MB 4a6862dbadda: Loading layer [==================================================>] 23.25MB/23.25MB ........... [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. [Step 3]: checking existing instance of Harbor ... [Step 4]: starting Harbor ... Creating network "harbor_harbor" with the default driver Creating harbor-log ... done Creating harbor-db ... done Creating harbor-adminserver ... done Creating redis ... done Creating registry ... done Creating harbor-ui ... done Creating harbor-jobservice ... done Creating nginx ... done ✔ ----Harbor has been installed and started successfully.---- Now you should be able to visit the admin portal at http://192.168.228.135. For more details, please visit https://github.com/vmware/harbor .
6、web界面测试截图
二、推送文件
1、推送报错
[root@luoahong1 ~]# docker push 192.168.228.135/library/busybox:latest The push refers to repository [192.168.228.135/library/busybox] Get https://192.168.228.135/v2/: dial tcp 192.168.228.135:443: connect: connection refused [root@luoahong1 ~]# systemctl restart docker [root@luoahong1 ~]# docker push 192.168.228.135/library/busybox:latest The push refers to repository [192.168.228.135/library/busybox] 683f499823be: Preparing denied: requested access to the resource is denied
修改/etc/docker/daemon.json文件
[root@luoahong1 ~]# vim /etc/docker/daemon.json "insecure-registries": ["192.168.228.135"]
2、推送成功
[root@luoahong1 ~]# docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username: admin Password: Error: Password Required [root@luoahong1 ~]# docker login 192.168.228.135 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@luoahong1 ~]# docker push 192.168.228.135/library/busybox:latest The push refers to repository [192.168.228.135/library/busybox] 683f499823be: Pushed latest: digest: sha256:bbb143159af9eabdf45511fd5aab4fd2475d4c0e7fd4a5e154b98e838488e510 size: 527
3、web界面截图
三、其他功能
1、两台hub同步
2、下载数量统计
3、下载加密
作者:罗阿红
出处:http://www.cnblogs.com/luoahong/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。