CentOS与Systemd上的Docker

问题描述:

我实际上正在使用Gitlab-CI对我的剧本进行自动化测试,Ubuntu工作得很好,没有问题。CentOS与Systemd上的Docker

这个问题实际上我是在CentOS和Systemd,首先是剧本(安装的Postgres 9.5里面CentOS7)的:

- 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 

我已经不得不在特权模式下运行容器,有c组和其他任何东西。已经尝试了不同的Docker容器,但没有任何工作。

当使用码头时,我认为它会更好,只需使用postgres来启动服务器。 命令状

postgres -D /opt/postgresql/data/ > /var/log/postgresql/pg_server.log 2>&1 & 

当您使用泊坞窗,你没有一个功能齐全的systemd。

您可以使用@KJocker建议的解决方案创建postgresql功能容器。或者,您可以配置systemd在容器内工作,这里是一个文档check

+0

在我启动docker-systemctl-replacement脚本之后,我非常幸运,因此我不必再花费一段时间来开发systemd守护进程;) –

我在Docker容器上使用Ansible时遇到了同样的情况....并且为此编写了docker-systemctl-replacement。它适用于PostgreSQL - 无需更改Ansible脚本,它可以保持这种方式在真机上进行部署。