我正在尝试使用Centos7和PostgreSQL 9.6设置Docker镜像。
我使用centos:centos7镜像作为基础,并按照此页面的步骤进行操作:https://wiki.postgresql.org/wiki/YUM_Installation 初始化数据库的步骤。
我尝试按照以下步骤启用systemd来运行CentOS镜像, https://hub.docker.com/_/centos/ 但没有起到作用。
我还尝试注释掉postgresql96-setup脚本中的语句。
现在 initdb 工作了。但启动服务时仍然显示相同的错误信息。
我使用centos:centos7镜像作为基础,并按照此页面的步骤进行操作:https://wiki.postgresql.org/wiki/YUM_Installation 初始化数据库的步骤。
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
我尝试按照以下步骤启用systemd来运行CentOS镜像, https://hub.docker.com/_/centos/ 但没有起到作用。
我还尝试注释掉postgresql96-setup脚本中的语句。
#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
我错过了什么吗?有人可以帮我吗?