Skip to content

Instantly share code, notes, and snippets.

@porjo
Last active August 29, 2015 14:09
Show Gist options
  • Save porjo/c8bfdb85ecf6570872f6 to your computer and use it in GitHub Desktop.
Save porjo/c8bfdb85ecf6570872f6 to your computer and use it in GitHub Desktop.
Postgresql 9.3 on Centos7, Dockerfile
FROM centos:centos7
RUN yum update -y
RUN yum install -y http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-1.noarch.rpm http://fedora.mirror.serversaustralia.com.au/epel/7/x86_64/e/epel-release-7-2.noarch.rpm
RUN yum install -y postgresql93-server postgis2_93 sudo
RUN /usr/pgsql-9.3/bin/postgresql93-setup initdb
# Adjust PostgreSQL configuration so that remote connections to the
# database are possible.
RUN echo "host all all 0.0.0.0/0 md5" >> /var/lib/pgsql/9.3/data/pg_hba.conf
# And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf``
RUN echo "listen_addresses='*'" >> /var/lib/pgsql/9.3/data/postgresql.conf
USER postgres
RUN /usr/pgsql-9.3/bin/pg_ctl start -D /var/lib/pgsql/9.3/data &&\
sleep 1 &&\
psql --command "ALTER USER postgres PASSWORD 'postgres';"
EXPOSE 5432
CMD ["/usr/pgsql-9.3/bin/postmaster","-p","5432","-D","/var/lib/pgsql/9.3/data"]
@porjo
Copy link
Author

porjo commented Nov 13, 2014

WARNING:

this dockerfile configures Postgres to listen on all interfaces and sets the default postgres user with password 'postgres'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment