1. 我是皮皮虾首页
  2. 网站部署

harbor-db restarting (1) seconds ago

环境

  • centos7.6
  • harbor-db:v2.3.2
  • docker:17.12.0-ce

问题复现

宿主机重启后,docker harbor-db总是在restarting,看日志提示数据库已存在

[root@hdss-7-200 harbor]# tail -f /var/log/harbor/postgresql.log 
Mar  3 12:44:10 172.17.0.1 postgresql[972]: initdb: error: directory "/var/lib/postgresql/data/pg13" exists but is not empty
Mar  3 12:44:10 172.17.0.1 postgresql[972]: If you want to create a new database system, either remove or empty
Mar  3 12:44:10 172.17.0.1 postgresql[972]: the directory "/var/lib/postgresql/data/pg13" or run initdb
Mar  3 12:44:10 172.17.0.1 postgresql[972]: with an argument other than "/var/lib/postgresql/data/pg13".

解决方法

方法一:

修改docker-compose.yaml文件,在postgresql服务中增加privileged: true

  postgresql:
    image: goharbor/harbor-db:v2.3.2
    container_name: harbor-db
    restart: always
    cap_drop:
      - ALL
    cap_add:
      - CHOWN
      - DAC_OVERRIDE
      - SETGID
      - SETUID
    privileged: true

方法二:

还没有尝试哈,看github上面提示将docker升级到就行20.10.8

Works after upgrading Docker to Docker version 20.10.8, build 3967b7d

原创文章,作者:站长,如若转载,请注明出处:https://wsppx.cn/2507/%e7%bd%91%e7%ab%99%e9%83%a8%e7%bd%b2/

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注