2017-02-16 53 views
1

我實際上正在使用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容器,但沒有任何工作。

回答

0

當使用碼頭時,我認爲它會更好,只需使用postgres來啓動服務器。 命令狀

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

當您使用泊塢窗,你沒有一個功能齊全的systemd。

您可以使用@KJocker建議的解決方案創建postgresql功能容器。或者,您可以配置systemd在容器內工作,這裏是一個文檔check

+0

在我啓動docker-systemctl-replacement腳本之後,我非常幸運,因此我不必再花費一段時間來開發systemd守護進程;) –

0

我在Docker容器上使用Ansible時遇到了同樣的情況....並且爲此編寫了docker-systemctl-replacement。它適用於PostgreSQL - 無需更改Ansible腳本,它可以保持這種方式在真機上進行部署。