Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 684 Bytes

setup-postgres-database.md

File metadata and controls

30 lines (25 loc) · 684 Bytes

Pull/Download Official Postgres Image From Docker Hub

docker pull postgres

Pull/Download Specific Official Postgres Image From Docker Hub

docker pull postgres:15.6

Create/Run Postgres Container

docker run --name postgres-15.6 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres:15.6
docker run --name postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -d -p 5432:5432 postgres

Verify Executing Container

docker ps

Interact With Executing Container

docker exec -it postgres-15.6 bash

Connect to a PostgreSQL Database Server

psql -h localhost -U postgres