{"id":13474128,"url":"https://github.com/mrts/docker-postgresql-multiple-databases","last_synced_at":"2025-05-16T19:08:54.823Z","repository":{"id":24112308,"uuid":"98812854","full_name":"mrts/docker-postgresql-multiple-databases","owner":"mrts","description":"Using multiple databases with the official PostgreSQL Docker image","archived":false,"fork":false,"pushed_at":"2023-12-02T06:49:32.000Z","size":9,"stargazers_count":727,"open_issues_count":11,"forks_count":265,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-12T18:51:41.507Z","etag":null,"topics":["docker","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-30T17:14:14.000Z","updated_at":"2025-04-11T10:51:12.000Z","dependencies_parsed_at":"2022-07-15T13:47:11.920Z","dependency_job_id":"c58ada95-5625-44b1-abc8-c8f2ae9d4f7d","html_url":"https://github.com/mrts/docker-postgresql-multiple-databases","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fdocker-postgresql-multiple-databases","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fdocker-postgresql-multiple-databases/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fdocker-postgresql-multiple-databases/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrts%2Fdocker-postgresql-multiple-databases/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrts","download_url":"https://codeload.github.com/mrts/docker-postgresql-multiple-databases/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254592395,"owners_count":22097013,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","postgresql"],"created_at":"2024-07-31T16:01:09.739Z","updated_at":"2025-05-16T19:08:54.806Z","avatar_url":"https://github.com/mrts.png","language":"Shell","funding_links":[],"categories":["Shell","docker"],"sub_categories":[],"readme":"# Using multiple databases with the official PostgreSQL Docker image\n\nThe [official recommendation](https://hub.docker.com/_/postgres/) for creating\nmultiple databases is as follows:\n\n*If you would like to do additional initialization in an image derived from\nthis one, add one or more `*.sql`, `*.sql.gz`, or `*.sh` scripts under\n`/docker-entrypoint-initdb.d` (creating the directory if necessary). After the\nentrypoint calls `initdb` to create the default `postgres` user and database,\nit will run any `*.sql` files and source any `*.sh` scripts found in that\ndirectory to do further initialization before starting the service.*\n\nThis directory contains a script to create multiple databases using that\nmechanism.\n\n## Usage\n\n### By mounting a volume\n\nClone the repository, mount its directory as a volume into\n`/docker-entrypoint-initdb.d` and declare database names separated by commas in\n`POSTGRES_MULTIPLE_DATABASES` environment variable as follows\n(`docker-compose` syntax):\n\n    myapp-postgresql:\n        image: postgres:9.6.2\n        volumes:\n            - ../docker-postgresql-multiple-databases:/docker-entrypoint-initdb.d\n        environment:\n            - POSTGRES_MULTIPLE_DATABASES: db1,db2\n            - POSTGRES_USER: myapp\n            - POSTGRES_PASSWORD:\n\n### By building a custom image\n\nClone the repository, build and push the image to your Docker repository,\nfor example for Google Private Repository do the following:\n\n    docker build --tag=eu.gcr.io/your-project/postgres-multi-db .\n    gcloud docker -- push eu.gcr.io/your-project/postgres-multi-db\n\nYou still need to pass the `POSTGRES_MULTIPLE_DATABASES` environment variable\nto the container:\n\n    myapp-postgresql:\n        image: eu.gcr.io/your-project/postgres-multi-db\n        environment:\n            - POSTGRES_MULTIPLE_DATABASES: db1,db2\n            - POSTGRES_USER: myapp\n            - POSTGRES_PASSWORD:\n\n### Non-standard database names\n\nIf you need to use non-standard database names (hyphens, uppercase letters etc), quote them in `POSTGRES_MULTIPLE_DATABASES`:\n\n        environment:\n            - POSTGRES_MULTIPLE_DATABASES: \"test-db-1\",\"test-db-2\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrts%2Fdocker-postgresql-multiple-databases","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrts%2Fdocker-postgresql-multiple-databases","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrts%2Fdocker-postgresql-multiple-databases/lists"}