soniya.rayabagi
Thu Feb 22 2024
Create a PostgreSQL Database in Docker .
#devops #docker
Step 1:
Download the latest version of the Postgres image :
docker pull postgres
Step 2:
Create and Run Postgres Container :
docker run -d --name -p 5432:5432 -e POSTGRES_PASSWORD= postgres
Step 3:
Verify Executing Container :
docker ps
Step 4:
Interact with Executing Container :
docker exec -it bash
Step 5:
Connect to Postgresql Database Server :
psql -h localhost -U postgres
Step 6:
Create Postgresql Database :
CREATE DATABASE ;
\l
Step 7:
Establish a connection with database :
\c
Step 8:
Create Database User :
CREATE USER with PASSWORD ;
Step 9:
Exit :
\q
#devops #docker