I am trying to setup a docker image with Centos7 and PostgreSQL 9.6.
I use the centos:centos7 image as base, and I follow the steps from this page: https://wiki.postgresql.org/wiki/YUM_Installation
The step to initialize the 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
I tried to follow these steps to enable systemd for the CentOS image, https://hub.docker.com/_/centos/ But it does not help.
I also tried to comment out the stmts in the postgresql96-setup script
#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
Now the initdb works. But starting the service gives me the same error message
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
Did I miss anything? Anyone can help me out of this?
Failed to get D-Bus connection: Operation not permitted: serverfault.com/questions/824975/…