7

I have a Rails app that I'm deploying using Docker containers. I'm using PostgreSQL for the database, and I'm trying to set up WAL-E to do continuous backups to an S3 bucket. The setup for this involves making a few changes to the postgresql.conf file.

I am using a postgres official image as a base image, and am passing in a postgresql.conf file. Here is my Dockerfile:

FROM postgres:9.4
MAINTAINER David Ham <me@example.com>

RUN apt-get update -y && apt-get install -y \
    git \
    python-virtualenv \
    python-dev \
    python-pip \
    libevent-dev \
    pv \
    lzop

RUN virtualenv /opt/wale \
    && . /opt/wale/bin/activate \
    && pip install git+https://github.com/wal-e/wal-e

COPY postgresql.conf /postgresql-wal-e/postgresql-wal-e.conf

RUN chown -R postgres:postgres /postgresql-wal-e

CMD ["postgres", "-c", "config-file=/postgresql-wal-e/postgresql-wal-e.conf"]

Is this right? It seems to have copied in correctly, but is this the right way to configure Postgres with their official images?

David Ham
  • 833
  • 3
  • 12
  • 27
  • 1
    Possible duplicate of [How to customize the configuration file of the official PostgreSQL docker image?](http://stackoverflow.com/questions/30848670/how-to-customize-the-configuration-file-of-the-official-postgresql-docker-image) – nwinkler Feb 09 '17 at 11:01
  • can you keep a file besides your docker image 'postgresql.cnf', which will contain changes you needed, and once the installation of postgres is complete then can you COPY that file to desired (/var/lib/postgres/data/) folder? – Rajesh Aug 28 '17 at 07:11

1 Answers1

-1

yes, your way to configure should work.

you can find other ways in answers of this question How to customize the configuration file of the official PostgreSQL Docker image?

Ryabchenko Alexander
  • 10,057
  • 7
  • 56
  • 88