部署 harbor 私有仓库时无法正常启动 harbor 实例及 client 端无法正常访问用户界面和 register 服务

文章目录

环境

部署 Harbor 私有仓库

主机 IP地址 操作系统 所需软件
harbor 192.168.126.16 CentOS 7 docker-ce、docker-compose、harbor
client 192.168.126.17 CentOS 7 docker-ce

故障现象(一):无法正常启动 harbor 实例

修改Harbor.cfg配置文件后得正确操作步骤:
1.需要先停止现有得Harbor实例并更新Harbor.cfg
2.然后运行prepare脚本来填充配置
3.最后再来重新创建并启动Harbor实例


--
报错:没有命令'up_d',最开始下意识想到是不是开启不成功是不是因为没有关闭防火墙,docker有没有重启?这是很多时候会出现得现象


[root@docker harbor]# docker-compose up-d
No such command: up_d

Commands:
  build              Build or rebuild services
  bundle             Generate a Docker bundle from the Compose file
  config             Validate and view the Compose file
  create             Create services
  down               Stop and remove containers, networks, images, and volumes
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  images             List images
  kill               Kill containers
  logs               View output from containers
  pause              Pause services
  port               Print the public port for a port binding
  ps                 List containers
  pull               Pull service images
  push               Push service images
  restart            Restart services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for a service
  start              Start services
  stop               Stop services
  top                Display the running processes
  unpause            Unpause services
  up                 Create and start containers
  version            Show the Docker-Compose version information

[root@docker harbor]# systemctl restart docker.service 
[root@docker harbor]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@docker harbor]# docker-compose up -d
Creating network "harbor_harbor" with the default driver
Creating harbor-log ... done
Creating harbor-db          ... done
Creating harbor-adminserver ... done
Creating registry           ... done
Creating harbor-ui          ... done
Creating nginx              ... done
Creating harbor-jobservice  ... done

'//细细回想,原来是我命令敲快打错了,低级错误!是up -d,我直接up-d了,不过注意防火墙及配置更新后即使重启服务是个好习惯!'

故障现象(二):client 端无法正常访问用户界面和 register 服务

之前得操作都是在Harbor服务器本地操作,但是如果其他客户端上传镜像到 Harbor,就可能会报错
出现这问题是因为Docker Registry交互默认使用的是 HTTPS,但是搭建私有镜 
像默认使用的是HTTP服务,所以与私有镜像交互时会出现错误


--
报错:client端无法正常登录
[root@client ~]# docker login -u admin -p Harbor12345 http://192.168.126.16
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Error response from daemon: Get https://192.168.126.16/v2/: dial tcp 192.168.126.16:443: connect: connection refused		'//报错:连接拒绝'
[root@client ~]# vim /usr/lib/systemd/system/docker.service
ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry 192.168.126.16 --containerd=/run/containerd/containerd.sock
'//需要修改此行,指向harbor服务器IP地址,之后就可以连接了'
[root@client ~]# systemctl daemon-reload
[root@client ~]# systemctl restart docker
[root@client ~]# docker login  -u admin -p Harbor12345 http://192.168.126.16
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
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		'//登录成功!'
上一篇:从学龄前开始解读FFMPEG代码 之 av_register_all函数


下一篇:springboot+junit5 练习,由浅入深(一)