Today I Learned: How to run PostgreSQL using Docker

Prerequisite

  1. Docker

  2. Generate Postgres Container

Step 1

> docker exec -it <-container-id-> bash

container-id can be found easier using the Docker Desktop (If you have it installed in your machine). Just copy and paste it OR you can run the command

> docker container ls

Using this command you can find your running containers (including postgres) wherein you can copy and use it for step 1

Step 2

> su - postgres

By running this command, you are allowing the postgres capability.

Step 3

> psql

run this command to access postgres and voila!

You are in! ๐Ÿ™

If you think this article helped you, you can support me by clicking - buy me a coffee -

Happy Coding

ย