Skip to content

robbierobs/docker-postgresql-multiple-databases

Repository files navigation

Using multiple databases with the official PostgreSQL Docker image

A PostgreSQL docker build that allows the creation of multiple databases in one container

This build uses a script to create additional databases and grants all privileges to the databases to the admin user.

Usage

postgres:
    restart: always
    image: irobbierobinson/multi-db-postgres:latest
    volumes:
        - ./pg-db-data:/var/lib/postgresql/data
    environment:
        - POSTGRES_PASSWORD=postgres
        - POSTGRES_USER=postgres
        - POSTGRES_DB=postgres
        - POSTGRES_ADDITIONAL_DATABASES=db,keycloak
    ports:
        - 5432:5432
    networks:
        - backend

Environment Variables

POSTGRES_PASSWORD - Admin Password (default: postgres) POSTGRES_USER - Admin Username (default: postgres) POSTGRES_DB - Default Postgresql DB Name (default: postgres) POSTGRES_ADDITIONAL_DATABASES - Additional databases that will be created alongside the default (separated by commas).

About

Using multiple databases with the official PostgreSQL Docker image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 83.2%
  • Dockerfile 16.8%