From 03af87f6b94dc82ddfe77bd305c6e82e450ed4e8 Mon Sep 17 00:00:00 2001 From: Aditya NV <138525577+aditya-nv-06@users.noreply.github.com> Date: Fri, 3 Oct 2025 13:50:50 +0000 Subject: [PATCH] Add Docker installation instructions for PostgreSQL --- psql/installation.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/psql/installation.md b/psql/installation.md index 90e5590..3772fc3 100644 --- a/psql/installation.md +++ b/psql/installation.md @@ -48,4 +48,37 @@ 4. Optionally, you can secure your PostgreSQL installation by setting a password for the database superuser account (`postgres`). +### Docker + +1. The prerequsite for this is installation of the docker containerzation tool docker + +2. Check the version of the docker tool + ``` + docker --version + ``` + +3. Pull the offical postgreSql image + ``` + docker pull postgres + ``` + +4. Start a postgresSql container + ``` + docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres + ``` + - Replace the `mysecretpassword` with your desired password + - This starts a container named my-postgres in the background + +5. Enter the postgresSql shell inside the container(only while running) + ``` + docker exec -it my-postgres psql -U postgres + ``` + - This opens the interative psql shell as the postgres user + +6. To stop and remove the container when done + ``` + docker stop my-postgres + docker rm my-postgres + ``` + --- \ No newline at end of file