Sign inSign up

pdbs/postgres

By pdbs

Updated about 6 years ago

PostgreSQL DB

Image
0

10K+

pdbs/postgres repository overview

Postgresql Database Server

Start Service

Folder 'main' will be created in directory $basedir:

docker service create --name $serviceName \
  --network $networkName \
  --mount type=bind,src=/$basedir/10,dst=/var/lib/postgresql/10 \
pdbs/postgres

Enable SSL

Place the certificates and CA certificate in /$basedir before the first start of the container/service

Certificates:

/$basedir/server.crt
/$basedir/server.key

CA:

/$basedir/root.crt

Migration to Postgres 10

From Tag 10.x.y on, Postgres version is 10.x and image version is y. Untagged versions are Postgres 9.5 which have to be updated manually.

The update procedure is as following:

  • exec bash into container and perform as postgres user pg_dumpall -f backupfile
  • stop the service or container
  • backup /$basedir
  • create folder '9.5' under /$basedir
  • move contents of /$basedir (main directory and backup if existing) to /$basedir/9.5
  • create folder '10' under /$basedir
  • edit bind mount:
...
--mount type=bind,src=/$basedir/9.5,dst=/var/lib/postgresql/9.5
--mount type=bind,src=/$basedir/10,dst=/var/lib/postgresql/10
...
  • start service or container (new image should be pulled containing Ubuntu 18.04 and Postgres 10)
  • restore backupfile as postgres user using psql < backupfile

Optional:

  • copy backup folder and scripts from /$basedir/9.5 to /$basedir/10
  • stop service or container
  • remove bind mount 'type=bind,src=/$basedir/9.5,dst=/var/lib/postgresql/9.5'
  • start service or container

Tag summary

Content type

Image

Digest

Size

106.9 MB

Last updated

about 6 years ago

docker pull pdbs/postgres