A R Karthick | e3bde96 | 2016-09-27 15:06:35 -0700 | [diff] [blame^] | 1 | FROM ubuntu |
| 2 | |
| 3 | RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 |
| 4 | |
| 5 | RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list |
| 6 | |
| 7 | RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --force-yes\ |
| 8 | python-software-properties \ |
| 9 | software-properties-common \ |
| 10 | postgresql-9.3 \ |
| 11 | postgresql-client-9.3 \ |
| 12 | postgresql-contrib-9.3 |
| 13 | |
| 14 | # Workaround for AUFS issue |
| 15 | # https://github.com/docker/docker/issues/783#issuecomment-56013588 |
| 16 | RUN mkdir /etc/ssl/private-copy; mv /etc/ssl/private/* /etc/ssl/private-copy/; rm -r /etc/ssl/private; mv /etc/ssl/private-copy /etc/ssl/private; chmod -R 0700 /etc/ssl/private; chown -R postgres /etc/ssl/private |
| 17 | |
| 18 | USER postgres |
| 19 | |
| 20 | RUN /etc/init.d/postgresql start && \ |
| 21 | psql --command "ALTER USER postgres WITH SUPERUSER PASSWORD 'password' " && \ |
| 22 | psql --command "CREATE DATABASE xos" |
| 23 | |
| 24 | # Allow remote connections. |
| 25 | RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.3/main/pg_hba.conf |
| 26 | RUN echo "host all all 0.0.0.0/0 password" >> /etc/postgresql/9.3/main/pg_hba.conf |
| 27 | |
| 28 | RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf |
| 29 | |
| 30 | # Expose the PostgreSQL port |
| 31 | EXPOSE 5432 |
| 32 | |
| 33 | VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"] |
| 34 | |
| 35 | CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"] |