fedora-cloud/Fedora-Dockerfiles — pull request #46 by docbill (2014-08-27 14:14:40+00:00)
Title: Updates to simplify postgres image and fix a few bugs.

1. The yum commands should use && between the commands. In my particular case, I have docker configured to connect to dnsmasq on my 172.17.42.1. If it happens dnsmasq isn't running, the yum update and yum install commands fail, but docker will treat it as success because yum clean all succeeds. By using && instead of ; a failure in the yum update or yum install is treated appropriately.

2. Without setting a language the database defaults to "C" locale. That means only 7 bit ascii characters will be stored properly.

3. The setup scripts are for the wrong major version of postgresql. e.g. 9.2, but the current is 9.3. This was causing me problems. After updating the script to the correct version I realized only a one line patch is needed. As such it is better to do that patch with an sed command rather than supplying a script that will likely become outdated long before the script is updated in a way where the patch doesn't work...

4. I didn't really see the point of the other scripts, so I dropped them. In my child image I do the following to create the database I need:

ADD login.sql /var/lib/pgsql/login.sql
ADD schema.sql /var/lib/pgsql/schema.sql
ADD perm.sql /var/lib/pgsql/perm.sql

RUN /usr/bin/supervisord -n & spid=$!;(sleep 5;createdb sfreports && \
psql -f ./login.sql sfreports && \
psql -f ./schema.sql sfreports && \
psql -f ./perm.sql sfreports && \
kill $spid && sleep 5)

Clearly though what sql commands one will want to issue to create there database will depend on thier needs, so I did not include that in this public Dockerfile.

Maybe though adding a few lines to the README to discribe how to connect to the database within a Dockerfile is not a bad idea.