From 72bbc9346aa1744a7ce1651ae1b6059e8c9a5ef6 Mon Sep 17 00:00:00 2001 From: Ivan Vakhrushev Date: Sat, 13 Apr 2024 13:07:23 +0400 Subject: [PATCH] Add docker-compose file to run PostgreSQL locally (#366) --- docker/docker-compose.yml | 17 +++++++++++++++++ docker/local_development.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 docker/docker-compose.yml create mode 100644 docker/local_development.md diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..693f667 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,17 @@ +version: "3.9" + +services: + postgres: + image: postgres:16.1 + environment: + POSTGRES_DB: "pgih-db" + POSTGRES_USER: "pgih-db-user" + POSTGRES_PASSWORD: "pgih-db-password" + PGDATA: "/var/lib/postgresql/data/pgdata" + volumes: + - pgih-db-data:/var/lib/postgresql/data + ports: + - "6432:5432" + +volumes: + pgih-db-data: diff --git a/docker/local_development.md b/docker/local_development.md new file mode 100644 index 0000000..a332abc --- /dev/null +++ b/docker/local_development.md @@ -0,0 +1,29 @@ +# Run PostgreSQL in Docker for local development + +## Docker Compose + +### Start + +```shell +docker-compose --project-name="pgih-db" up -d +``` + +### Stop + +```shell +docker-compose --project-name="pgih-db" down +``` + +## Explore volumes + +### List all volumes + +```shell +docker volume ls +``` + +### Delete specified volume + +```shell +docker volume rm pgih-db_pgih-db-data +```