{"id":19065593,"url":"https://github.com/caiorss/postgres-docker-container","last_synced_at":"2026-04-08T22:32:14.665Z","repository":{"id":90043292,"uuid":"81635428","full_name":"caiorss/postgres-docker-container","owner":"caiorss","description":"Very lightweight and simple to setup postgres SQL docker image.","archived":false,"fork":false,"pushed_at":"2017-02-11T06:29:25.000Z","size":5,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T12:03:04.431Z","etag":null,"topics":["alpine","database","docker","image","linux","postgres","postgresql","vritualization"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caiorss.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"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-02-11T06:28:43.000Z","updated_at":"2025-07-27T06:48:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab5d8d7f-ae06-4fcb-ac56-2795889b2369","html_url":"https://github.com/caiorss/postgres-docker-container","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/caiorss/postgres-docker-container","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiorss%2Fpostgres-docker-container","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiorss%2Fpostgres-docker-container/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiorss%2Fpostgres-docker-container/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiorss%2Fpostgres-docker-container/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caiorss","download_url":"https://codeload.github.com/caiorss/postgres-docker-container/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caiorss%2Fpostgres-docker-container/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31577444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["alpine","database","docker","image","linux","postgres","postgresql","vritualization"],"created_at":"2024-11-09T00:51:17.885Z","updated_at":"2026-04-08T22:32:14.645Z","avatar_url":"https://github.com/caiorss.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"#+TITLE: PostgresSQL Database Docker\n#+KEYWORKDS: docker container virtualizatio postgres sql database server \n\n* Usage \n** Build the image\n\nRun _$ make_. \n\n#+BEGIN_SRC sh\n  $ make \n  docker build -t alpine-db -f Dockerfile .\n  Sending build context to Docker daemon 66.56 kB\n  Step 1 : FROM alpine\n   ---\u003e 88e169ea8f46\n  Step 2 : RUN echo \"@edge http://nl.alpinelinux.org/alpine/edge/main\" \u003e\u003e /etc/apk/repositories \u0026\u0026     apk update \u0026\u0026     apk add curl \"libpq@edge\u003c9.7\" \"postgresql-client@edge\u003c9.7\" \"postgresql@edge\u003c9.7\" \"postgresql-contrib@edge\u003c9.7\" \u0026\u0026     mkdir /docker-entrypoint-initdb.d \u0026\u0026     curl -o /usr/local/bin/gosu -sSL \"https://github.com/tianon/gosu/releases/download/1.2/gosu-amd64\" \u0026\u0026     chmod +x /usr/local/bin/gosu \u0026\u0026     apk del curl \u0026\u0026     rm -rf /var/cache/apk/*\n   ---\u003e Running in 3738e1ff2782\n  fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz\n  fetch http://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz\n  fetch http://nl.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz\n  v3.5.1-30-gf9f9312ea3 [http://dl-cdn.alpinelinux.org/alpine/v3.5/main]\n  v3.5.1-29-ga981b1f149 [http://dl-cdn.alpinelinux.org/alpine/v3.5/community]\n  v3.5.0-1379-g2096f071a3 [http://nl.alpinelinux.org/alpine/edge/main]\n  OK: 13628 distinct packages available\n  (1/17) Installing ca-certificates (20161130-r0)\n  (2/17) Installing libssh2 (1.7.0-r2)\n  (3/17) Installing libcurl (7.52.1-r1)\n  (4/17) Installing curl (7.52.1-r1)\n  (5/17) Installing db (5.3.28-r0)\n  (6/17) Installing libsasl (2.1.26-r8)\n  (7/17) Installing libldap (2.4.44-r3)\n  (8/17) Installing libpq@edge (9.6.1-r1)\n  (9/17) Installing ncurses-terminfo-base (6.0-r7)\n  (10/17) Installing ncurses-terminfo (6.0-r7)\n  (11/17) Installing ncurses-libs (6.0-r7)\n  (12/17) Installing libedit (20150325.3.1-r3)\n  (13/17) Installing postgresql-client@edge (9.6.1-r1)\n  (14/17) Installing libxml2 (2.9.4-r0)\n  (15/17) Installing postgresql@edge (9.6.1-r1)\n  (16/17) Installing libuuid (2.28.2-r1)\n  (17/17) Installing postgresql-contrib@edge (9.6.1-r1)\n  Executing busybox-1.25.1-r0.trigger\n  Executing ca-certificates-20161130-r0.trigger\n  OK: 34 MiB in 28 packages\n  (1/4) Purging curl (7.52.1-r1)\n  (2/4) Purging libcurl (7.52.1-r1)\n  (3/4) Purging ca-certificates (20161130-r0)\n  Executing ca-certificates-20161130-r0.post-deinstall\n  (4/4) Purging libssh2 (1.7.0-r2)\n  Executing busybox-1.25.1-r0.trigger\n  OK: 32 MiB in 24 packages\n   ---\u003e eab0f50377ba\n  Removing intermediate container 3738e1ff2782\n  Step 3 : ENV LANG en_US.utf8\n   ---\u003e Running in 3b111630002c\n   ---\u003e a3d23eaebf06\n  Removing intermediate container 3b111630002c\n  Step 4 : ENV PGDATA /var/lib/postgresql/data\n   ---\u003e Running in 46adfc9e63da\n   ---\u003e 650993c8abfb\n  Removing intermediate container 46adfc9e63da\n  Step 5 : VOLUME /var/lib/postgresql/data\n   ---\u003e Running in e3d4b38e588e\n   ---\u003e 7855d253a6fa\n  Removing intermediate container e3d4b38e588e\n  Step 6 : COPY docker-entrypoint.sh /\n   ---\u003e fa979f4e92da\n  Removing intermediate container d5450586e2bb\n  Step 7 : ENTRYPOINT /docker-entrypoint.sh\n   ---\u003e Running in 2ca7348347e2\n   ---\u003e e261c9e00eeb\n  Removing intermediate container 2ca7348347e2\n  Step 8 : EXPOSE 5432\n   ---\u003e Running in 5911d7d15cb7\n   ---\u003e 1cc5270d47f7\n  Removing intermediate container 5911d7d15cb7\n  Step 9 : CMD postgres\n   ---\u003e Running in e6073f2d4229\n   ---\u003e ae9740746614\n  Removing intermediate container e6073f2d4229\n  Successfully built ae9740746614\n\n\n#+END_SRC\n** Test the docker image \n   \n - _$ make run_\n\nDescription: \n\n 1. make directory ./data  \n 2. Mount the directory ./data from host to /data in the container.\n 3. Bind the port 5432 listening only localhost (127.0.0.1) to the\n    container port 5432 (Postgres default port).\n 4. Run the database server postgresql \n\n#+BEGIN_SRC sh \n  $ make run\n  mkdir -p data \n  # mkdir -p ./data\n  # chmod 777 data \n  docker run -it -v /home/arch/Documents/projects/postgresq.docker/data:/data -p 127.0.0.1:5432:5432 alpine-db\n  LOG:  database system was shut down at 2017-02-11 04:06:25 UTC\n  LOG:  MultiXact member wraparound protections are now enabled\n  LOG:  database system is ready to accept connections\n  LOG:  autovacuum launcher started\n\n#+END_SRC\n\nTo connect to the database server open another shell and run _$ psql -h 127.0.0.1 -U postgres_ \n\n#+BEGIN_SRC sh\n  $ psql -h 127.0.0.1 -U postgres\n  psql (9.6.1)\n  Type \"help\" for help.\n\n  postgres=# \n#+END_SRC\n\n** Debug \n\nTo enter the docker shell run _$ make debug_. \n\n#+BEGIN_SRC sh\n  $ make debug\n  docker run -it -v /home/arch/Documents/projects/postgresq.docker/data:/data -p 127.0.0.1:5432:5432 --entrypoint=sh alpine-db\n  / # \n  / # ls /data \n  PG_VERSION            pg_ident.conf         pg_stat_tmp\n  base                  pg_logical            pg_subtrans\n  fileflag              pg_multixact          pg_tblspc\n  global                pg_notify             pg_twophase\n  pg_clog               pg_replslot           pg_xlog\n  pg_commit_ts          pg_serial             postgresql.auto.conf\n  pg_dynshmem           pg_snapshots          postgresql.conf\n  pg_hba.conf           pg_stat               postmaster.opts\n  / # \n\n#+END_SRC\n\n** Run \n\nTo start the docker use: \n\n#+BEGIN_SRC sh \n   $ docker run -it -v \u003cdirectory from host to be mounted\u003e:/data -p 127.0.0.1:5432:5432 alpine-db\n#+END_SRC\n\nOr edit the script file:postgres-docker.sh and run it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaiorss%2Fpostgres-docker-container","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaiorss%2Fpostgres-docker-container","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaiorss%2Fpostgres-docker-container/lists"}