CloudCodeTree LogoCloudCodeTree
AI NewsTutorialsAbout
CloudCodeTree Logo
CloudCodeTree
  • AI News
  • Tutorials
  • About
← Back to AI News
Your First Dedicated Vector Database: Weaviate Local Docker Quickstart in Python

Your First Dedicated Vector Database: Weaviate Local Docker Quickstart in Python

Chris Harper

2 min read

Jul 18, 2026 · 12:03 UTC

AI
Tutorial
Vectors
Embeddings
Self-Hosting

TL;DR: Three docker-compose lines, five Python lines, and you have a running vector database that semantically searches your documents without a cloud account or external embedding API.

What you'll be able to do after this:

  • Run Weaviate locally using Docker (embedding model included via Ollama — no API keys)
  • Create a typed collection and bulk-import documents with auto-vectorization
  • Execute near_text semantic search and retrieve ranked results from Python

What makes Weaviate different

Unlike pgvector (which bolts vector search onto PostgreSQL) or FAISS (an in-process library), Weaviate is a standalone vector database built ground-up for similarity search. It bundles HNSW indexing, BM25 keyword search, and hybrid search into one service with a schema-backed Python client and a gRPC-accelerated query path.

1. Start Weaviate + Ollama with Docker Compose

# docker-compose.yml
version: '3.4'
services:
  weaviate:
    image: semitechnologies/weaviate:latest
    ports:
      - "8080:8080"
      - "50051:50051"   # gRPC — required by the v4 Python client
    environment:
      ENABLE_MODULES: 'text2vec-ollama,generative-ollama'
      DEFAULT_VECTORIZER_MODULE: 'text2vec-ollama'
      CLUSTER_HOSTNAME: 'node1'
  ollama:
    image: ollama/ollama
    volumes:
      - ./ollama:/root/.ollama
    ports:
      - "11434:11434"
docker compose up -d
docker exec <ollama-container> ollama pull nomic-embed-text
pip install weaviate-client

2. Connect and create a collection

import weaviate
from weaviate.classes.config import Configure

client = weaviate.connect_to_local()   # hits localhost:8080

client.collections.create(
    name="Article",
    vectorizer_config=Configure.Vectorizer.text2vec_ollama(
        api_endpoint="http://ollama:11434",
        model="nomic-embed-text",
    ),
)

The text2vec-ollama module tells Weaviate to embed each object at insert time using your local Ollama model — no OpenAI key, no API bill.

3. Batch-import documents

articles = client.collections.get("Article")
with articles.batch.dynamic() as batch:
    for doc in your_documents:
        batch.add_object({"title": doc["title"], "body": doc["body"]})

batch.dynamic() auto-sizes batch requests based on server feedback.

4. Semantic search

results = articles.query.near_text(
    query="vector database indexing strategies",
    limit=5,
)
for obj in results.objects:
    print(obj.properties["title"])

That's the full loop: ingest → embed locally → query. Weaviate also supports near_vector (bring your own embeddings), pure BM25 keyword search, and hybrid (BM25 + vector) with a single flag — no extra search engine needed.

Sources: Weaviate Local Docker Quickstart (official) · DataCamp Weaviate tutorial · Vector Databases with Weaviate in Python — YouTube