登录 harbor dashboard

  1. 新建项目:

image.png

编辑 /etc/hosts

  1. # 添加一个域名,当然你也可以直接使用ip地址
  2. 192.168.109.10 hub.hexiaodai.com

制作镜像

  1. # 修改镜像 tag
  2. docker tag nginx:1.13.12 hub.hexiaodai.com/kubernetes/nginx:1.13.12

push 镜像

  1. [root@m1 nginx]# docker push hub.hexiaodai.com/kubernetes/nginx:1.13.12
  2. The push refers to repository [hub.hexiaodai.com/kubernetes/nginx]
  3. Get "https://hub.hexiaodai.com/v2/": dial tcp 192.168.109.10:443: connect: connection refused

修改 /etc/docker/daemon.json 设置 hub.hexiaodai.com 允许 http 访问

  1. vim /etc/docker/daemon.json
  2. # 新增参数,允许使用 http
  3. "insecure-registries": ["hub.hexiaodai.com"]

重启 docker

  1. service docker restart

重启 nginx

  1. > pwd
  2. /root/nginx
  3. > ls
  4. nginx.conf restart.sh
  5. > ./restart.sh

再次 push

需要登录 docker(harbor) docker login hub.hexiaodai.com

  1. [root@m1 nginx]# docker push hub.hexiaodai.com/kubernetes/nginx:1.13.12
  2. The push refers to repository [hub.hexiaodai.com/kubernetes/nginx]
  3. 7ab428981537: Preparing
  4. 82b81d779f83: Preparing
  5. d626a8ad97a1: Preparing
  6. denied: requested access to the resource is denied