Use docker PostgreSQL using DataGrip (Obuntu)

Mahedi Hasan Jisan
Oct 22, 2018 · 1 min read

I am going to show you how to use PostgreSQL using docker container. Let’s start:

To pull the docker postgres image in your system use:

docker pull postgres

Create a directory for your postgres instance:

mkdir -p $HOME/docker/volumes/postgres

Run your docker postgres image in that directory with setting name and password:

docker run — rm — name pg-docker -e POSTGRES_PASSWORD=cramstack@2018 -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres

This will create the docker image with a verification.

Next install DataGrip from Jetbrins:

use CTRL+ALT+SHIFT+S to download PostgreSQL in DataGrip and apply it.

From data source and use PostgreSQL to connect to your docker PostgreSQL image:

Connecting to localhost PostgreSQL

After inputting correct user name and password, you are connect.!! Yayy.

Create Database and use SQL to create your tables and their contents.

For example, you will see something like this:

Query to get data from Database using PostgreSQL

Enjoy! Happy Programming!

If you see any mistakes, feel free to let me know in the comment section.

Thanks, cheers 😆

Written by

Assistant Teacher and Assistant Researcher at University of Regina

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade