Public Repository

Last pushed: 2 years ago
Short Description
Ubuntu with postgresql 9.3
Full Description

password for user db docker is docker

data insida container:

$ mkdir -p $HOME/postgresdata
$ sudo docker run -v="$HOME/postgresdata":"/data" -i -t -p 5432 axce1/postgresql93 /bin/bash

cp /etc/postgresql/9.3/main/postgresql.conf /data/postgresql.conf

cp /etc/postgresql/9.3/main/pg_hba.conf /data/pg_hba.conf

sed -i '/^data_directory*/ s|/var/lib/postgresql/9.3/main|/data/main|' /data/postgresql.conf

sed -i '/^hba_file*/ s|/etc/postgresql/9.3/main/pg_hba.conf|/data/pg_hba.conf|' /data/postgresql.conf

mkdir -p /data/main

chown postgres /data/*

chgrp postgres /data/*

chmod 700 /data/main

su postgres --command "/usr/lib/postgresql/9.3/bin/initdb -D /data/main"

optional Allow access from any IP address

sed -i "/^#listen_addresses/i listen_addresses='*'" /data/postgresql.conf

sed -i "/^# DO NOT DISABLE!/i # Allow access from any IP address" /data/pg_hba.conf

sed -i "/^# DO NOT DISABLE!/i host all all 0.0.0.0/0 md5\n\n\n" /data/pg_hba.conf

start database

su postgres --command "/usr/lib/postgresql/9.3/bin/postgres -D /data/main -c config_file=/data/postgresql.conf" &

optional

su postgres --command 'createuser -P -d -r -s docker'

su postgres --command 'createdb -O docker docker'

stop database

su postgres --command '/usr/lib/postgresql/9.3/bin/pg_ctl --pgdata=/data/main stop'

RUN COMMAND

sudo docker run -v="$HOME/postgresdata":"/data" -d -p 5432 axce1/ubuntu_postgresql93:OPTIONAL_TAGNAME su postgres --command "/usr/lib/postgresql/9.3/bin/postgres -D /data/main -c config_file=/data/postgresql.conf"

Docker Pull Command
Owner
axce1