nginx代理harbor和registry

发布时间 2023-10-08 15:35:06作者: 普里莫

nginx代理harbor

[root@harbor100 harbor]# docker run -p 90:90 -v /nginx:/etc/nginx/conf.d/ -d nginx:alpine 

/nginx/1_ttt.conf
server {
    listen 80;		# 代理后端口
    server_name xx.xx.com;		# 代理后访问地址

    location /harbor {
        proxy_pass http://harbor;			# 这里对应的是上面upstream后指定的名称
     }
}

## Harbor配置
# 进入安装harbor的目录
vim /root/harbor/harbor.yml

exitrnal_url: http://blog.harbor.com

# 在物理机上配置域名解析
10.0.0.100 blog.harbor.com

# 从新启动
[root@harbor ~]# cd /root/harbor/
# 1.停止所有容器
[root@harbor harbor]# docker-compose stop
# 2.删除所有容器
[root@harbor harbor]# docker rm -f $(docker ps -aq)
# 3.启动harbor
[root@harbor harbor]# docker-compose up -d

---------------------------
## harbor机器
# 2.修改配置文件
[root@docker01 ~]# vim /etc/docker/daemon.json
{
  "registry-mirrors": ["https://l72cwnqn.mirror.aliyuncs.com"],
  "insecure-registries": ["http://10.0.0.100","http://10.0.0.102:5000","http://blog.harbor.com"]
}

# 1.重启docker
[root@docker01 ~]# systemctl restart docker
# 2.推送镜像
[root@docker01 ~]# docker push 10.0.0.102:5000/centos:7
# 3.查看镜像
[root@docker01 ~]# curl http://10.0.0.102:5000/v2/_catalog
{"repositories":["centos","wp"]}