排错-harbor-db容器异常重启
看报错提示是由于数据目录不为空导致初始化失败,docker-compose.yml 中将宿主机目录 /data/database 挂载进容器的。(默认的docker-compose log driver走了tcp syslog, 可以自行更改)docker-compose.yml中新增 privileged: true ,使用特权模式。harbor-db 容器一直restart,查看日志发现 报错
·
排错-harbor-db容器异常重启

环境:
docker 19.03 , harbor-db(postgresql) goharbor/harbor-db:v2.5.6
现象:
harbor-db 容器一直restart,查看日志发现 报错
initdb: error: directory "/var/lib/postgresql/data/pg13" exists but is not empty
If you want to create a new database system, either remove or empty
the directory "/var/lib/postgresql/data/pg13" or run initdb
with an argument other than "/var/lib/postgresql/data/pg13".
ls: cannot access '/var/lib/postgresql/data': Operation not permitted
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
(默认的docker-compose log driver走了tcp syslog, 可以自行更改)
原因:
看报错提示是由于数据目录不为空导致初始化失败,docker-compose.yml 中将宿主机目录 /data/database 挂载进容器的
解决:
解决办法一:
不保留数据,清空容器宿主机上的数据目录 ,再重启重启就行
#rm -rf /data/database/*
解决办法二:
保留数据,docker-compose.yml中新增 privileged: true ,使用特权模式, ,再重启重启就行
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)