初始化centos docker镜像上的postgres失败,无法获得D-Bus连接:不允许操作

我试图在Docker镜像上安装postgres,基本镜像运行centos。

我正在按照如何在CentOS 7上安装PostgreSQL关系数据库的说明进行操作,这里是我的Dockerfile:

FROM our-internal-docker-registry.org/centos:7.3.1611 RUN yum install -y postgresql-server postgresql-contrib RUN postgresql-setup initdb 

第一个RUN命令成功,但是第二个失败,并且:

 Step 3/3 : RUN postgresql-setup initdb ---> Running in d26f43467aa0 Failed to get D-Bus connection: Operation not permitted failed to find PGDATA setting in postgresql.service The command '/bin/sh -c postgresql-setup initdb' returned a non-zero code: 1 

我承认自己对下一步该怎么做也不知情,因为我对postgres或者linux并不熟悉。 希望得到一些build议。

“D-Bus连接:操作不允许”提示它想联系SystemD守护进程。 我使用postgres和https://github.com/gdraheim/docker-systemctl-replacement来避免这种情况。