我正在尝试在 docker 镜像上安装 postgres,基础镜像正在运行 centos。
我正在按照 How to Install PostgreSQL Relational Databases on CentOS 7 中的说明进行操作这是我的 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 不是很熟悉。希望得到一些建议。
最佳答案
“D-Bus connection: Operation not permitted”暗示它想要联系 SystemD 守护进程。我在 centos 上使用 postgres 以及 https://github.com/gdraheim/docker-systemctl-replacement避免这种情况。
关于postgresql - 在 centos docker 图像上初始化 postgres 失败,无法获得 D-Bus 连接 : Operation not permitted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46494668/