11notes/postgres

By 11notes

β€’Updated 20 days ago

run PostgeSQL rootless

Buildkit cache
Helm
Image
Databases & storage
0

10K+

11notes/postgres repository overview

banner

⁠POSTGRES

size5pxpulls5px5pxswiss_made

run PostgeSQL rootless

⁠INTRODUCTION πŸ“’

PostgreSQL is a powerful, open-source, object-relational database management system known for its reliability, feature set, and adherence to standards. It supports both SQL (relational) and JSON (non-relational) querying and is backed by a large, active community.

⁠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 scheduler that will backup your database if POSTGRES_BACKUP_SCHEDULE is set. It allows for incremental backups too if enabled.

Supported PostgreSQL versions: 15, 16, 17 and 18

⁠UNIQUE VALUE PROPOSITION πŸ’Ά

Why should I run this image and not the other image(s) that already exist? Good question! Because ...

  • ... this image runs rootless⁠ as 1000:1000
  • ... this image has a health check
  • ... this image runs read-only
  • ... this image is automatically scanned for CVEs before and after publishing
  • ... this image is created via a secure and pinned CI/CD process
  • ... this image is very small
  • ... this image can take full and incremental backups on its own

If you value security, simplicity and optimizations to the extreme, then this image might be for you.

⁠COMPARISON 🏁

Below you find a comparison between this image and the most used or original one.

imagesize on diskinit default asdistroless⁠supported architectures
11notes/postgres61MB1000:1000❌amd64, arm64, armv7
postgres304MB0:0❌386, amd64, arm64v8, armv6, armv7, ppc64le, riscv64, s390x

⁠VOLUMES πŸ“

  • /postgres/etc - Directory of config files
  • /postgres/var - Directory of database files

⁠COMPOSE βœ‚οΈ

Checkout compose.secrets.yml⁠ if you want to use secrets instead of environment variables.

name: "db"

x-lockdown: &lockdown
  # prevents write access to the image itself
  read_only: true
  # prevents any process within the container to gain more privileges
  security_opt:
    - "no-new-privileges=true"

services:
  postgres:
    image: "11notes/postgres:18"
    <<: *lockdown
    environment:
      TZ: "Europe/Zurich"
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      # make a full and compressed database backup each day at 03:00
      POSTGRES_BACKUP_SCHEDULE: "0 3 * * *"
      # only keep the last five backups
      POSTGRES_BACKUP_RETENTION: 5
    ports:
      - "5432:5432/tcp"
      - "9090:9187/tcp"
    networks:
      frontend:
    volumes:
      - "postgres.etc:/postgres/etc"
      - "postgres.var:/postgres/var"
      - "postgres.backup:/postgres/backup"
    tmpfs:
      # needed for read-only
      - "/postgres/run:uid=1000,gid=1000"
      - "/postgres/log:uid=1000,gid=1000"
    restart: "always"

volumes:
  postgres.etc:
  postgres.var:
  postgres.backup:

networks:
  frontend:

To find out how you can change the default UID/GID of this container image, consult the RTFM⁠.

⁠DEFAULT SETTINGS πŸ—ƒοΈ

ParameterValueDescription
userdockeruser name
uid1000user identifier⁠
gid1000group identifier⁠
home/postgreshome directory of user docker

⁠ENVIRONMENT πŸ“

ParameterValueDefault
TZTime Zone⁠
DEBUGWill activate debug option for container image and app (if available)
POSTGRES_PASSWORDPassword for the postgres user
POSTGRES_PASSWORD_FILE (optional)Secrets file containing the password for the postgres user (check compose.secrets.yml⁠)
POSTGRES_BACKUP_SCHEDULE (optional)Set backup schedule for full backups (crontab style)
POSTGRES_BACKUP_RETENTION (optional)Set backup retention points to keep0 (disabled)

⁠MAIN TAGS 🏷️

These are the main tags for the image. There is also a tag for each commit and its shorthand sha256 value.

⁠REGISTRIES ☁️

docker pull 11notes/postgres:18
docker pull ghcr.io/11notes/postgres:18
docker pull quay.io/11notes/postgres:18

⁠UNRAID VERSION 🟠

This image supports unraid by default. Simply add -unraid to any tag and the image will run as 99:100 instead of 1000:1000.

⁠NOBODY VERSION πŸ‘»

This image supports nobody by default. Simply add -nobody to any tag and the image will run as 65534:65534 instead of 1000:1000.

⁠SOURCE πŸ’Ύ

⁠PARENT IMAGE πŸ›οΈ

⁠BUILT WITH 🧰

⁠GENERAL TIPS πŸ“Œ

  • Use a reverse proxy like Traefik, Nginx, HAproxy to terminate TLS and to protect your endpoints
  • Use Let’s Encrypt DNS-01 challenge to obtain valid SSL certificates for your services

⁠ElevenNotesℒ️

This image is provided to you at your own risk. Always make backups before updating an image to a different version. Check the releases⁠ for breaking changes. If you have any problems with using this image simply raise an issue⁠, thanks. If you have a question or inputs please create a new discussion⁠ instead of an issue. You can find all my other repositories on github⁠.

created 23.07.2026, 08:46:35 (CET)

Tag summary

Content type

Image

Digest

sha256:5c0f70507…

Size

28 MB

Last updated

20 days ago

docker pull 11notes/postgres:18