diff --git a/Dockerfile b/Dockerfile index d6dd5e4..fa56d0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Postgresql (http://www.postgresql.org/) -FROM phusion/baseimage:0.9.13 +FROM phusion/baseimage:0.9.16 MAINTAINER Ryan Seto # Ensure we create the cluster with UTF-8 locale @@ -8,7 +8,9 @@ RUN locale-gen en_US.UTF-8 && \ echo 'LANG="en_US.UTF-8"' > /etc/default/locale # Disable SSH (Not using it at the moment). -RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh +#RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh + +RUN /etc/my_init.d/00_regen_ssh_host_keys.sh # Install the latest postgresql RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \ @@ -18,6 +20,11 @@ RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" > /etc/ postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 && \ /etc/init.d/postgresql stop +# work around for AUFS bug +# as per https://github.com/docker/docker/issues/783#issuecomment-56013588 +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 + + # Install other tools. RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pwgen inotify-tools diff --git a/README.md b/README.md index 0e20c53..efcb4df 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ $ mkdir -p /tmp/postgresql $ docker run -d --name="postgresql" \ -p 127.0.0.1:5432:5432 \ -v /tmp/postgresql:/data \ - -e USER="super" \ + -e DB_USER="super" \ -e DB="database_name" \ -e PASS="$(pwgen -s -1 16)" \ paintedfox/postgresql @@ -68,7 +68,7 @@ directory, and the superuser username and password on the host like so: $ sudo mkdir -p /srv/docker/postgresql $ make run PORT=127.0.0.1:5432 \ DATA_DIR=/srv/docker/postgresql \ - USER=super \ + DB_USER=super \ PASS=$(pwgen -s -1 16) ``` @@ -88,7 +88,7 @@ password for the superuser. To view the login in run `docker logs ``` shell $ docker logs postgresql -POSTGRES_USER=super +POSTGRES_DB_USER=super POSTGRES_PASS=b2rXEpToTRoK8PBx POSTGRES_DATA_DIR=/data Starting PostgreSQL... @@ -136,7 +136,7 @@ $ psql -U "$DB_ENV_USER" \ -p "$DB_PORT_5432_TCP_PORT" ``` -If you ran the *postgresql* container with the flags `-e USER=` and `-e +If you ran the *postgresql* container with the flags `-e DB_USER=` and `-e PASS=`, then the linked container should have these variables available in its environment. Since we aliased the database container with the name *db*, the environment variables from the database container are copied into the diff --git a/scripts/first_run.sh b/scripts/first_run.sh index 253f2ab..1cd11ea 100644 --- a/scripts/first_run.sh +++ b/scripts/first_run.sh @@ -1,4 +1,4 @@ -USER=${USER:-super} +USER=${DB_USER:-super} PASS=${PASS:-$(pwgen -s -1 16)} pre_start_action() { @@ -13,7 +13,7 @@ pre_start_action() { echo "Initializing PostgreSQL at $DATA_DIR" # Copy the data that we generated within the container to the empty DATA_DIR. - cp -R /var/lib/postgresql/9.3/main/* $DATA_DIR + cp -aR /var/lib/postgresql/9.3/main/* $DATA_DIR fi # Ensure postgres owns the DATA_DIR