Posgres (oficial) based image built with supervisor and confd to allow dynamic configuration updates
2.6K
PostgreSQL docker container insightsoftware/postgres which includes supervisor and confd to allow dynamic configuration updates.
The default user for PostgreSQL (e.g. "postgres").
The password for the default user.
The backend confd will use to update de configuration templates. The default is set to environment variables (i.e. "env").
Environment variable used by confd to update postgresql.conf (see the official documentation for more details about this file). Some configurations can be set directly (i.e. "max_connections", "listen_addresses", "authentication_timeout", "statement_timeout") while other can be added as key value pairs through the "extra_configs" key.
{
"max_connections":"<maximum number of connections>",
"listen_addresses":"<addesses to listen to>",
"authentication_timeout":"<authentication timeout>",
"statement_timeout":"<statement timeout>",
"extra_configs": [
{ "key": "<key1>", "value": "<value1>" },
{ "key": "<key2>", "value": "<value2>" },
<other key value pairs>
]
}
docker run <parameters>
-e POSTGRESQL_CONFIG='{ "max_connections": "50", "listen_addresses": "*", "authentication_timeout": "1min", "statement_timeout": "60000" }'
<other parameters>
insightsoftware/postgres
Environment variable used by confd to update pg_hba.conf (see the official documentation for more details about the configuration fields).
{
configs: [
{
"type": "<connection type>",
"database": "<database>",
"user": "<user>",
"address": "<addresses allowed>",
"method": "<authentication method>"
},
<extra configurations>
]
}
docker run <parameters>
-e PG_HBA_CONFIG='{"configs": [{"type": "host", "database": "all", "user": "all", "address": "0.0.0.0/0", "method": "md5" }]}'
<other parameters>
insightsoftware/postgres
You can run the container, accepting connections from all ip addresses, using the following command:
docker run -d --name insight_postgres \
-e POSTGRES_USER='postgres' \
-e POSTGRES_PASSWORD='password' \
-e POSTGRESQL_CONFIG='{ "max_connections": "50", "listen_addresses": "*", "authentication_timeout": "1min", "statement_timeout": "60000" }' \
-e PG_HBA_CONFIG='{"configs": [{"type": "host", "database": "all", "user": "all", "address": "0.0.0.0/0", "method": "md5" }]}' \
-p 5432:5432 \
-v /var/lib/insight_postgres/data/:/var/lib/postgresql/data \
insightsoftware/postgres
FROM postgres:9.5
MAINTAINER Hubble Infrastructure <[email protected]>
ENV CONFD_VERSION 0.12.0-alpha3
ENV CONFD_SHA1 437524fe3334bd9d0424ed0ece265472e789d19e
ENV PYTHON_VERSION=2.7.9-1
ENV PY_PIP_VERSION=1.5.6-5
ENV PYTHON_PKG_VERSION=5.5.1-1
ENV PYTHON_SETUPTOOLS_VERSION=5.5.1-1
ENV SUPERVISOR_VERSION=3.0r1-1
ENV SUPERVISOR_CONF='{"programs": [{"program": "postgresql", "command": "/docker-entrypoint.sh postgres", "stopsignal":"SIGINT", "priority": "1", "autostart": "true", "autorestart": "true", "startsecs": "0", "stdout_logfile": "/var/log/supervisor/postgresql.log"}]}'
ENV CONFD_BACKEND='env'
ENV PGDATA='/var/lib/postgresql/data'
#Install confd and Supervisor
RUN set -ex && \
apt-get update && \
apt-get -y install wget ca-certificates && \
wget https://github.com/kelseyhightower/confd/releases/download/v$CONFD_VERSION/confd-$CONFD_VERSION-linux-amd64 -O /usr/local/bin/confd && \
chmod +x /usr/local/bin/confd && \
mkdir /var/log/supervisor && \
apt-get -y install python=$PYTHON_VERSION python-pkg-resources=$PYTHON_PKG_VERSION python-setuptools=$PYTHON_SETUPTOOLS_VERSION supervisor=$SUPERVISOR_VERSION && \
rm -rf /etc/supervisor/supervisor.conf && \
apt-get -y remove wget ca-certificates && \
apt-get -y clean && apt-get -y autoremove
#Configure confd
COPY ./confd /etc/confd
#Configure Supervisor
COPY ./supervisor /etc/supervisor
########### CUSTOM INSTRUCTIONS ###########
COPY initConfd.sh /
RUN chmod +x /initConfd.sh
EXPOSE 5432
####### END OF CUSTOM INSTRUCTIONS ########
#Entrypoint
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
Content type
Image
Digest
Size
115.3 MB
Last updated
almost 9 years ago
docker pull insightsoftware/postgres:1.0.7