{"id":19711715,"url":"https://github.com/brightcommerce/docker-postgresql","last_synced_at":"2026-06-09T18:31:38.993Z","repository":{"id":20627004,"uuid":"23908625","full_name":"brightcommerce/docker-postgresql","owner":"brightcommerce","description":"Dockerfile to build a PostgreSQL v9.3.5 container image with contribs \u0026 postgis which can be linked to other containers.","archived":false,"fork":false,"pushed_at":"2014-09-11T12:24:02.000Z","size":120,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T19:56:01.705Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/brightcommerce.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-09-11T07:29:05.000Z","updated_at":"2015-11-25T00:19:11.000Z","dependencies_parsed_at":"2022-09-10T22:41:41.225Z","dependency_job_id":null,"html_url":"https://github.com/brightcommerce/docker-postgresql","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/brightcommerce/docker-postgresql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brightcommerce%2Fdocker-postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brightcommerce%2Fdocker-postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brightcommerce%2Fdocker-postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brightcommerce%2Fdocker-postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brightcommerce","download_url":"https://codeload.github.com/brightcommerce/docker-postgresql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brightcommerce%2Fdocker-postgresql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34121021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-11T22:13:30.550Z","updated_at":"2026-06-09T18:31:38.976Z","avatar_url":"https://github.com/brightcommerce.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker PostgreSQL\n\nDockerfile to build a PostgreSQL v9.3.5 container image with contribs and postgis which can be linked to other containers.\n\n## Table of Contents\n\n- [Version](#version)\n- [Installation](#installation)\n- [How To Use](#how-to-use)\n- [Configuration](#configuration)\n    - [Ports](#ports)\n    - [Data Store](#data-store)\n    - [Securing The Server](#securing-the-server)\n- [Shell Access](#shell-access)\n- [Upgrading](#upgrading)\n- [Credit](#credit)\n\n## Version\n\nThe current release (v9.3.5) contains scripts to install PostgreSQL v9.3.5, and uses the Brightcommerce Ubuntu 14.04 base image. Our version numbers will reflect the version of PostgreSQL being installed.\n\n## Installation\n\nPull the latest version of the image from the Docker Index. This is the recommended method of installation as it is easier to update the image in the future. These builds are performed by the **Docker Trusted Build** service.\n\n``` bash\ndocker pull brightcommerce/postgresql:latest\n```\n\nor specify a tagged version:\n\n``` bash\ndocker pull brightcommerce/postgresql:9.3.5\n```\n\nAlternately you can build the image yourself:\n\n``` bash\ngit clone https://github.com/brightcommerce/docker-postgresql.git\ncd docker-postgresql\ndocker build -t=\"$USER/postgresql\" .\n```\n\n## How To Use\n\nRun the PostgreSQL image:\n\n``` bash\ndocker run --name postgresql -d brightcommerce/postgresql:latest\n```\n\nBy default remote logins are permitted to the PostgreSQL server and a random password is assigned for the `postgres` user. The password set for the `postgres` user can be retrieved from the container logs.\n\n``` bash\ndocker logs postgresql\n```\n\nIn the output you will notice the following lines with the password:\n\n``` bash\n|------------------------------------------------------------------|\n| PostgreSQL User: postgres, Password: xxxxxxxxxxxxxx              |\n|                                                                  |\n| To remove the PostgreSQL login credentials from the logs, please |\n| make a note of password and then delete the file pwfile          |\n| from the data store.                                             |\n|------------------------------------------------------------------|\n```\n\nAssuming you have `psql` installed on the host, you can test if the PostgreSQL server is working properly by connecting to the server:\n\n``` bash\npsql -U postgres -h $(docker inspect --format {{.NetworkSettings.IPAddress}} postgresql)\n```\n\nIf you don't have `psql` installed on the host you will need to shell into the container and perform the `psql` tests there. Since we are running CoreOS at DigitalOcean, we have a readonly filesystem. This means we can't install tools the traditional way.\n\nSee [Shell Access](#shell-access) for instructions on how to install `nsenter` and `docker-enter` on a host. Once this is installed you can use `docker-enter` to shell into the container and play with `psql`.\n\n``` bash\ndocker inspect --format {{.NetworkSettings.IPAddress}} postgresql\n172.17.0.28\nsudo docker-enter postgresql\nroot@965a5c5d2e55:~# psql -U postgres -h 172.17.0.28\nPassword for user postgres: xxxxxxxxxxxxxx\npsql (9.3.5)\nType \"help\" for help.\n\npostgres=# \\list\n                             List of databases\n   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges\n-----------+----------+----------+---------+-------+-----------------------\n postgres  | postgres | UTF8     | C       | C     |\n template0 | postgres | UTF8     | C       | C     | =c/postgres          +\n           |          |          |         |       | postgres=CTc/postgres\n template1 | postgres | UTF8     | C       | C     | =c/postgres          +\n           |          |          |         |       | postgres=CTc/postgres\n(3 rows)\n\npostgres=# \\q\nroot@965a5c5d2e55:~# logout\n```\n\n## Configuration\n\n### Ports\n\nThis installation exposes port `5432`.\n\n### Data Store\n\nFor data persistence a volume should be mounted at `/var/lib/postgresql`.\n\nSELinux users are also required to change the security context of the mount point so that it plays nicely with SELinux.\n\n``` bash\nmkdir -p /opt/postgresql/data\nsudo chcon -Rt svirt_sandbox_file_t /opt/postgresql/data\n```\n\nThe updated `run` command looks like this:\n\n``` bash\ndocker run --name postgresql -d -v /opt/postgresql/data:/var/lib/postgresql brightcommerce/postgresql:latest\n```\n\nThis will make sure that the data stored in the database is not lost when the image is stopped and restarted.\n\n### Securing The Server\n\nBy default a randomly generated password is assigned for the `postgres` user. The password is stored in a file named `pwpass` in the data store and is printed in the logs.\n\nIf you don't want this password to be displayed in the logs, then please note down the password listed in `/opt/postgresql/data/pwpass` and then delete the file.\n\n``` bash\ncat /opt/postgresql/data/pwfile\nrm /opt/postgresql/data/pwfile\n```\n\nAlternately, you can change the password of the `postgres` user:\n\n``` bash\npsql -U postgres -h $(docker inspect --format {{.NetworkSettings.IPAddress}} postgresql) password postgres\n```\n\n## Shell Access\n\nFor debugging and maintenance purposes you may want access the container shell. Since the container does not allow interactive login over the SSH protocol, you can use the [nsenter](http://man7.org/linux/man-pages/man1/nsenter.1.html) linux tool (part of the util-linux package) to access the container shell.\n\nSome linux distros (e.g. ubuntu) use older versions of the util-linux which do not include the `nsenter` tool. To get around this @jpetazzo has created a nice docker image that allows you to install the `nsenter` utility and a helper script named `docker-enter` on these distros.\n\nTo install the `nsenter` tool on your host execute the following command:\n\n``` bash\ndocker run --rm -v /usr/local/bin:/target jpetazzo/nsenter\n```\n\nIf you are running CoreOS on the host and have difficulties using the above command because of the readonly filesystem, execute the following instructions in the `core` users' home directory:\n\n``` bash\nmkdir -p tools/bin\ndocker run --rm jpetazzo/nsenter cat /nsenter \u003e tools/bin/nsenter\ncurl -L https://raw.githubusercontent.com/jpetazzo/nsenter/master/docker-enter \u003e tools/bin/docker-enter\nchmod +x tools/bin/*\n```\n\nThen add the toolset binaries to the system path:\n\n``` bash\nmv .bashrc .bashrc-original\nsudo curl -L https://raw.githubusercontent.com/brightcommerce/coreos/master/bashrc \u003e ~/.bashrc\nsudo ln -s /root/.bashrc /root/.bash_profile\nsource ~/.bashrc\n````\n\nNow you can access the container shell using the `docker-enter` command:\n\n``` bash\nsudo docker-enter postgresql\n```\n\nFor more information refer https://github.com/jpetazzo/nsenter.\n\nAnother tool named `nsinit` can also be used for the same purpose. Please refer https://jpetazzo.github.io/2014/03/23/lxc-attach-nsinit-nsenter-docker-0-9/ for more information.\n\n## Upgrading\n\nTo upgrade to newer releases, simply follow this 3 step upgrade procedure.\n\n- **Step 1**: Stop the currently running image:\n\n``` bash\ndocker stop postgresql\n```\n\n- **Step 2**: Update the docker image:\n\n``` bash\ndocker pull brightcommerce/postgresql:latest\n```\n\n- **Step 3**: Start the image:\n\n``` bash\ndocker run --name postgresql -d [OPTIONS] brightcommerce/postgresql:latest\n```\n\n## Credit\n\nThis repository was based on the work of [docker-postgresql by Sameer Naik](https://github.com/sameersbn/docker-postgresql). Updated to install PostgreSQL v9.3.5 with contribs and postgis.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrightcommerce%2Fdocker-postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrightcommerce%2Fdocker-postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrightcommerce%2Fdocker-postgresql/lists"}