我正在尝试使用Centos7和PostgreSQL 9.6设置docker镜像。
我使用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我尝试按照以下步骤为CentOS映像https://hub.docker.com/_/centos/启用systemd,但没有帮助。
我还尝试注释掉postgresql96-setup脚本中的stmt
#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我错过什么了吗?有人能帮我解决这个问题吗?
发布于 2017-11-30 00:52:13
"D-Bus连接:不允许操作“是Postgres想要与SystemD守护进程对话的提示。我使用https://github.com/gdraheim/docker-systemctl-replacement在centos-7 docker容器中运行Postgres,以避免这种情况。
发布于 2017-08-17 06:08:16
解释了潜在的问题,并可以通过以下答案来解决:
Failed to get D-Bus connection: Operation not permitted - Server Fault
您可以创建自己的新映像(centos7-systemd),但它并不像看起来那么难。但是要注意严格按照它所说的去做,通过:
docker run --privileged -ti -e container=docker -v /sys/fs/cgroup:/sys/fs/cgroup centos7-systemd /usr/sbin/init
然后通过例如连接到它
$ sudo docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6667f8acbe5c centos7-systemd "/usr/sbin/init" 33 minutes ago Up 13 minutes eager_brattain $ docker exec -it eager_brattain bash
然后在https://wiki.postgresql.org/wiki/YUM_Installation上运行这些postgres指令,它们会工作得很好。
https://stackoverflow.com/questions/40597424
复制相似问题