【发布时间】:2016-11-14 20:37:42
【问题描述】:
我正在尝试使用 Centos7 和 PostgreSQL 9.6 设置 docker 映像。
我使用 centos:centos7 映像作为基础,并按照此页面中的步骤操作:https://wiki.postgresql.org/wiki/YUM_Installation
初始化DB的步骤
sh-4.2# /usr/pgsql-9.6/bin/postgresql96-setup initdb
Failed to get D-Bus connection: Operation not permitted
failed to find PGDATA setting in postgresql-9.6.service
我尝试按照这些步骤为 CentOS 映像启用 systemd, https://hub.docker.com/_/centos/ 但这无济于事。
我也试过注释掉postgresql96-setup脚本中的stmts
#PGDATA=`systemctl show -p Environment "${SERVICE_NAME}.service" |
# sed 's/^Environment=//' | tr ' ' '\n' |
# sed -n 's/^PGDATA=//p' | tail -n 1`
#if [ x"$PGDATA" = x ]; then
# echo "failed to find PGDATA setting in ${SERVICE_NAME}.service"
# exit 1
#fi
现在 initdb 可以工作了。但是启动服务给了我同样的错误信息
sh-4.2# systemctl enable postgresql-9.6.service
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-9.6.service to /usr/lib/systemd/system/postgresql-9.6.service.
sh-4.2# systemctl start postgresql-9.6.service
Failed to get D-Bus connection: Operation not permitted
我错过了什么吗?任何人都可以帮我解决这个问题吗?
【问题讨论】:
-
不能用官方postgres镜像hub.docker.com/_/postgres
-
@Rao 我也遇到了同样的问题。您链接到的不是 Centos7。 CentOS 7 版本没有“最新”。他们链接到的是 9.5,而不是 9.6,并且没有设置为 root 以供进一步安装:hub.docker.com/r/centos/postgresql-95-centos7
-
这似乎是解决
Failed to get D-Bus connection: Operation not permitted的途径:serverfault.com/questions/824975/…
标签: postgresql docker centos7