docker中安装postgresql问题记录

2022-05-06  本文已影响0人  nnnnxcj

sudo /usr/bin/postgresql-setup initdb

Failed to get D-Bus connection: 不允许的操作
failed to find PGDATA setting in postgresql.service

vi /usr/bin/postgresql-setup
错误原因是因为setup脚本中使用 systemctl show -p Environment ...获取 PGDATA/PGPORT 但是容器中不可以执行 systemctl

vi /usr/lib/systemd/system/postgresql.service

/usr/lib/systemd/system/postgresql.service

修改成

/usr/bin/postgresql-setup

sudo /usr/bin/postgresql-setup initdb

初始化完成

PS:

ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA}
ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast
ExecReload=/usr/bin/pg_ctl reload -D ${PGDATA} -s
上一篇 下一篇

猜你喜欢

热点阅读