【发布时间】:2017-02-22 17:19:32
【问题描述】:
我正在尝试使用ansible-container 构建和运行两个托管 PostgreSQL 和 Citus 扩展的 Docker 容器。我知道 Citus 提供容器,但我想构建自己的容器。
我的container.yaml 如下所示:
version: '2'
services:
database_master:
image: hackermd/ubuntu-trusty-python
user: postgres
expose:
- 5043
entrypoint: ['dumb-init', '--']
command: ['/usr/bin/pg_ctlcluster', '9.6', 'master', 'start']
links:
- database_worker
depends_on:
- database_worker
database_worker:
image: hackermd/ubuntu-trusty-python
user: postgres
expose:
- 9700
entrypoint: ['dumb-init', '--']
command: ['/usr/bin/pg_ctlcluster', '9.6', 'worker', 'start']
在构建过程中,我可以通过pg_ctlcluster 启动和停止集群并成功完成。但是,当我随后运行容器时,出现以下错误:
$ docker logs ansible_database_master_1
Removed stale pid file.
Warning: connection to the database failed, disabling startup checks:
psql: FATAL: the database system is starting up
当我使用command: [] 构建容器并在容器内运行ps aux 时,我看到以下过程:
postgres 14 1.6 0.1 307504 3480 ? Ds 16:46 0:00 postgres: 9.6/master: startup process
我也尝试过不使用 dumb-init 入口点。我错过了什么?
【问题讨论】:
标签: postgresql docker ansible docker-compose ansible-container