Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
postgresql 9.3 (transient) Dockerfile on centos6.
postgresql-9:$ cat Dockerfile
# postgresql 9 on centos 6.5
#
# docker build -t 'your/pg' <thisfile>
#
# then run with:
# docker run -P -d your/pg
# tweakables are the 'ENV' lines further down
# (if they were higher up they'd blow the cache)
FROM saltstack/centos-6-minimal
MAINTAINER Dick Davies <dick@hellooperator.net>
# TODO: fix locale! not allowing UTF-8 and think it's this 'minimal' image
# add postgresql.org repo
RUN yum install -y http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
# install postgres rpms
RUN yum install -y postgresql93-server postgresql93-contrib
# NB: transient! might want to map volumes, etc.
ENV PGDATA /pgdata
# initialize
RUN mkdir $PGDATA
RUN chown postgres $PGDATA
RUN su -c - postgres /usr/pgsql-9.3/bin/initdb
# open up tcp access
RUN echo "host all all 0.0.0.0/0 md5" > $PGDATA/pg_hba.conf
# needed to createuser below
RUN echo "local all postgres trust" >> $PGDATA/pg_hba.conf
# superuser account
ENV SUPERUSER god
ENV SUPERPASS godmode
# fire up db, create superuser, shut down
RUN su -c - postgres "/usr/pgsql-9.3/bin/pg_ctl -w start && echo create role $SUPERUSER SUPERUSER LOGIN PASSWORD \'$SUPERPASS\' | psql && /usr/pgsql-9.3/bin/pg_ctl -w stop"
EXPOSE 5432
USER postgres
# listen on network, log to stdout
ENTRYPOINT ["/usr/pgsql-9.3/bin/postgres", "-i", "-c", "logging_collector=off"]
@larrycai

This comment has been minimized.

Copy link

commented Jul 3, 2014

did you fix locale problem ? in official centos:latest (6.5), the problem exists as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.