Retrieval-Augmented Generation (RAG) with Python, PostgreSQL, and Qdrant - Part 1: Installing PostgreSQL and Qdrant with Docker
Gen AI
1 August 2025

Retrieval-Augmented Generation (RAG) with Python, PostgreSQL, and Qdrant - Part 1: Installing PostgreSQL and Qdrant with Docker

In this article, we’ll explore how to prepare your environment for building a Retrieval-Augmented Generation (RAG) system using Python, PostgreSQL, and Qdrant.

Prerequisites

  • Docker installed

This example is based on macOS, but the steps should work on any OS that supports Docker.

1. Pull the latest PostgreSQL image

docker pull postgres:latest

2. Run PostgreSQL in a container

docker run --name local-postgres \
  -e POSTGRES_USER=admin \
  -e POSTGRES_PASSWORD=admin123 \
  -e POSTGRES_DB=mydb \
  -p 5432:5432 \
  -d postgres:latest

Explanation:

  • --name local-postgres: Names the container for easy reference
  • -e POSTGRES_USER=admin: Sets the default username
  • -e POSTGRES_PASSWORD=admin123: Sets the default password
  • -e POSTGRES_DB=mydb: Creates a database named mydb
  • -p 5432:5432: Maps PostgreSQL’s default port to your host
  • -d: Runs the container in detached mode

3. Check if PostgreSQL is running

docker ps

4. Pull and run the latest Qdrant image

docker run -d --name qdrant \
  -p 6333:6333 \
  qdrant/qdrant

This will:

  • Pull the latest Qdrant image
  • Expose the REST and gRPC APIs on port 6333
  • Run the container in detached mode (-d)

5. Verify Qdrant is running

curl http://localhost:6333/healthz

If Qdrant is running properly, it should return:

healthz check passed