A Docker container for PostgreSQL 9.3 with special features. Available for pulling from Docker Hub Registry.
Features:
Links:
$ docker build -t nimiq/postgresql .
-p 2223:22-p 5432:5432--volume=/mylocaldir:/srv/pgdata-e "PG_USERNAME=myuser"-e "PG_PASSWORD=mypass"-e "SSH_PUBLIC_KEY=..."$ docker run -d -p 2223:22 -p 5432:5432 --name postgresql --volume=/mylocaldir:/srv/pgdata -e "PG_USERNAME=myuser" -e "PG_PASSWORD=mypass" -e "SSH_PUBLIC_KEY=..." nimiq/postgresql
A more user-friendly input of the public SSH key:
$ read MY_SSH_KEY < ~/.ssh/id_rsa.pub
$ docker run -d -p 2223:22 -p 5432:5432 --name postgresql --volume=/mylocaldir:/srv/pgdata -e "PG_USERNAME=myuser" -e "PG_PASSWORD=mypass" -e "SSH_PUBLIC_KEY=$MY_SSH_KEY" nimiq/postgresql
Run a one-shot interactive shell:
$ read MY_SSH_KEY < ~/.ssh/id_rsa.pub
$ docker run -ti --rm -p 2223:22 -p 5432:5432 --name postgresql --volume=/mylocaldir:/srv/pgdata -e "PG_USERNAME=myuser" -e "PG_PASSWORD=mypass" -e "SSH_PUBLIC_KEY=$MY_SSH_KEY" nimiq/postgresql /sbin/my_init -- bash
$ docker start postgresql
$ docker stop postgresql
To SSH into the container, run from the host:
ssh [email protected] -p 2223
To connect to the PostgreSQL server, run from the host:
psql -h localhost -p 5432 -U myuser myuser
Key technologies used in Docker-PostgreSQL93:
Content type
Image
Digest
sha256:b5c44dc53…
Size
127.5 MB
Last updated
almost 11 years ago
docker pull nimiq/postgresql93