Sign inSign up

alpin3/postgres

By alpin3

•Updated over 10 years ago

PostgreSQL on Alpine (size: 23 MB)

Image
1

2.0K

alpin3/postgres repository overview

⁠alpin3/postgres

Multiple purpose PostgreSQL database based on Alpine

Image is based on the gliderlabs/alpine⁠ base image

⁠Docker image size

Latest

⁠Docker image usage

docker run [docker-options] alpin3/postgres


⁠Variables

Following environment variables will be used when running:

⁠Standard

PGDATA - location of PostgreSQL database files (default: /var/lib/postgresql/data) POSTGRES_USER - PostgreSQL username (if not specified: postgres) POSTGRES_PASSWORD - PostgreSQL password (if not specified: empty)

⁠Specific to this image

POSTGRES_DB - PostgreSQL database name (if not specified: same as POSTGRES_USER) POSTGRES_FIX_OWNERSHIP - PostgreSQL fix ownership of PGDATA

⁠Remarks

Note that if you don't specify any POSTGRES environment parameters, postgres will listen on all interfaces with ALL privileges as postgres user.

You just need to minimaly specify POSTGRES_USER as env variable in order to create PostgreSQL database with same name. Password will be empty.

By default, only permissions to access POSTGRES_DB is given to POSTGRES_USER. No SUPERUSER permissions will be given.

But you don't need SUPERUSER permissions really. If you connect locally, it should not ask you for password, so you can use following procedure:

docker exec -it postgres_containerid /bin/sh
# gosu postgres psql

Only if nothing is specified, user postgres will have SUPERUSER privileges with access allowed from all hosts.

⁠Examples

Quick testing (you can connect to this host from any hosts with username postgres):

docker run -it --rm alpin3/postgres

Typical usage, create user test and database test:

docker run -it -v /host/dir/for/db:/var/lib/postgresql/data -e POSTGRES_USER=test alpin3/postgres

Typical usage, create user test with password Passw0rd and database testdb

docker run -it -v /host/dir/for/db:/var/lib/postgresql/data -e POSTGRES_USER=test -e POSTGRES_PASSWORD=Passw0rd -e POSTGRES_DB=testdb alpin3/postgres
⁠Todo
  • Provide more examples

Tag summary

Content type

Image

Digest

Size

10.4 MB

Last updated

over 10 years ago

docker pull alpin3/postgres