https://github.com/slok/docker-postgresql
Docker postgresql container
https://github.com/slok/docker-postgresql
Last synced: 6 months ago
JSON representation
Docker postgresql container
- Host: GitHub
- URL: https://github.com/slok/docker-postgresql
- Owner: slok
- License: bsd-3-clause
- Created: 2014-12-31T15:09:20.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-01-01T18:33:41.000Z (almost 11 years ago)
- Last Synced: 2025-02-16T07:55:56.395Z (8 months ago)
- Language: Shell
- Homepage:
- Size: 145 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Run your postgreSQL docker container!
=====================================Step 0 (Configure)
------First place your configuration files `ph_hba.conf` and `postgresql.conf` for postgresql
The default changes are:
In `postresql.conf`:
data_directory = '/data'
listen_addresses = '*'In `pg_hba.conf`:
host all all 0.0.0.0/0 md5
Then set the first user, password and DB for Postgres in `default_user.sh`:
USER="docker"
PASS="docker"
DB="docker"Step 1 (Build containers)
-------------------------$ docker build -t slok/postgresql-data:1.0 ./postgresql-data/
$ docker build -t slok/postgresql:1.0 ./postgresqlStep 2 (Data container)
-----------------------Run the data container if isn't already created/stopped-container:
$ docker run --name postgresql-data slok/postgresql-data:1.0
Step 3 (postgresql)
-------------------$ docker run -d --volumes-from="postgresql-data" --name=postgres slok/postgresql:1.0
Extra
-----If you want to connect to the database you could use the psql client from the same container
running a new one like this:$ docker run --rm -it --link postgres:db slok/postgresql:1.0 /bin/bash
And then inside the container (docker is the default user, change it if you want):
$ psql -h $DB_PORT_5432_TCP_ADDR -U docker