我实际上正在使用Gitlab-CI对我的剧本进行自动化测试,Ubuntu工作得非常好,没有任何问题。
实际上我遇到的问题是CentOS和Systemd,首先是攻略(在CentOS7中安装Postgres9.5):
- name: Ensure PostgreSQL is running
service:
name: postgresql-9.5
state: restarted
ignore_errors: true
when:
- ansible_os_family == 'RedHat'所以,如果我想在容器中启动postgres,这是我得到的结果:
Failed to get D-Bus connection: Operation not permitted\nFailed to get D-Bus connection: Operation not permitted\nFailed to get D-Bus connection: Operation not permitted\nFailed to get D-Bus connection: Operation not permitted\nFailed to get D-Bus connection: Operation not permitted\n我已经不得不在特权模式下运行Container,使用c-group和其他任何东西。已经尝试了不同的Docker容器,但都不起作用。
发布于 2017-02-17 10:14:59
当使用docker时,我认为使用postgres启动服务器会更好。命令类似
postgres -D /opt/postgresql/data/ > /var/log/postgresql/pg_server.log 2>&1 &发布于 2017-02-18 01:34:15
当你使用docker时,你没有一个功能齐全的systemd。
您可以使用@KJocker建议的解决方案来制作postgresql函数容器。或者,您可以将systemd配置为在容器内工作,这里是一个文档check
发布于 2017-03-23 23:24:50
在Docker容器上使用Ansible时,我也遇到了同样的情况。我已经为此编写了一个docker-systemctl-replacement。它适用于PostgreSQL -不需要更改Ansible脚本,它可以在真实计算机上的部署中保持这种方式。
https://stackoverflow.com/questions/42280065
复制相似问题