11notes/postgres

By 11notes

Updated 4 months ago

PostgreSQL for Docker

Image
Databases & Storage
0

537

Banner

🏔️ Alpine - Postgres

sizeversionpulls

PostgreSQL for Docker

SYNOPSIS

What can I do with this? This image will run postgres as postgres with the database postgres and the password you set initially. Why so simple? Because 99.9% of all containers that need postgres, are happy with the default settings, no different dbname, different dbuser, whatever needed. It also adds a simple backup command to backup the entire database.

VOLUMES

  • /postgres/etc - Directory of config files
  • /postgres/var - Directory of database files
  • /postgres/sql - Directory of SQL scripts which will be executed once and then deleted!
  • /postgres/backup - Directory of backups

COMPOSE

name: "postgres"
services:
  postgres:
    image: "11notes/postgres:16"
    container_name: "postgres"
    environment:
      TZ: "Europe/Zurich"
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
    ports:
      - "5432:5432/tcp"
    volumes:
      - "etc:/postgres/etc"
      - "var:/postgres/var"
      - "sql:/postgres/sql"
      - "backup:/postgres/backup"
    restart: "always"
volumes:
  etc:
  var:
  sql:
  backup:

To take a full backup simply run

docker exec postgres backup

DEFAULT SETTINGS

ParameterValueDescription
userdockeruser docker
uid1000user id 1000
gid1000group id 1000
home/postgreshome directory of user docker
config/postgres/etc/default.confdefault configuration file

ENVIRONMENT

ParameterValueDefault
TZTime Zone
DEBUGShow debug information
POSTGRES_PASSWORDpassword for user postgres
POSTGRES_SQL_GUACAMOLEInitialize database for Guacamole

SOURCE

PARENT IMAGE

BUILT WITH

TIPS

  • Use a reverse proxy like Traefik, Nginx to terminate TLS with a valid certificate
  • Use Let’s Encrypt certificates to protect your SSL endpoints

ElevenNotes™️

This image is provided to you at your own risk. Always make backups before updating an image to a new version. Check the changelog for breaking changes. You can find all my repositories on github.

Docker Pull Command

docker pull 11notes/postgres