二进制部署K8s集群第5节之私有仓库Harbor搭建

上一章:二进制部署K8s集群第4节之docker环境安装
二进制部署K8s集群第5节之私有仓库Harbor搭建
部署于HDSS7-200.host.com上
github下载地址:https://github.com/goharbor/harbornginx

1、下载软件解压git

mkdir /src;cd /src
rz  ==> harbor-offline-installer-v2.1.0.tgz
tar xf harbor-offline-installer-v2.1.0.tgz -C /opt/
cd /opt/
mv harbor/ harbor-v2.1.0
ln -s /opt/harbor-v2.1.0/ /opt/harbor

2、配置harbor.ymlgithub

cd /opt/harbor/
cp harbor.yml.tmpl harbor.yml
vi harbor.yml
5   hostname: harbor.od.com
10  port: 180
13 #https:
15 #  port: 443
17 #  certificate: /your/certificate/path
18 #  private_key: /your/private/key/path
34  harbor_admin_password: Harbor12345
47  data_volume: /data/harbor
125 location: /data/harbor/logs
mkdir -p /data/harbor/logs

3、安装harbordocker

yum install docker-compose -y
sh /opt/harbor/install.sh
docker-compose ps
docker ps -a

4、安装配置Nginx浏览器

yum -y install nginx
cat > /etc/nginx/conf.d/harbor.od.com.conf <<eof
server {
    listen 80;
    server_name harbor.od.com;
    client_max_body_size 1000m;
    location / {
        proxy_pass http://127.0.0.1:180;
    }
}
eof
nginx -t
systemctl start nginx
systemctl enable nginx
curl harbor.od.com

5、浏览器访问curl

http://harbor.od.com
用户名:admin
密码:Harbor12345

6、建立公有项目
二进制部署K8s集群第5节之私有仓库Harbor搭建ide

7、推送镜像到公有仓库url

docker pull nginx:1.7.9  # 等价于docker pull docker.io/library/nginx:1.7.9
[root@hdss7-200 conf.d]# docker images | grep 1.7.9
nginx                           1.7.9               84581e99d807        5 years ago         91.7MB
docker login harbor.od.com   # 用户名admin,密码Harbor12345
docker tag 84581e99d807 harbor.od.com/public/nginx:v1.7.9 
docker push harbor.od.com/public/nginx:v1.7.9

8、查看镜像
二进制部署K8s集群第5节之私有仓库Harbor搭建code