Run ChromaDB in Docker and practice collections, explicit embeddings, and similarity queries.
Chroma is a developer-friendly vector store often used for retrieval-augmented generation. This lab runs the Chroma server, creates a collection, upserts documents with explicit vectors, and queries the nearest neighbors through the Python client.
docker compose up -d
python -m pip install chromadb
python examples/chroma_client.py
curl -s http://localhost:8000/api/v2/heartbeat| Field | Value |
|---|---|
| URL | http://localhost:8000 |
| Heartbeat | /api/v2/heartbeat (newer versions; /api/v1/heartbeat on older ones) |
| Collection | lab |
| Embeddings | explicit vectors so no model download is required |
| File | What it shows |
|---|---|
docker-compose.yml |
Engine, ports, and persistent volume. |
.github/workflows/compose-check.yml |
Validates the Compose file on every push. |
examples/chroma_client.py |
Create a collection, upsert documents, and query. |
examples/01_heartbeat.sh |
Check the server without the Python client. |
- Replace the toy vectors with embeddings from a real model and query with a sentence.
- Add metadata filters to the query (for example, only
topic=vector). - Delete a document and confirm it no longer appears in results.
- Compare cosine and L2 distance on the same collection.
- The Python example uses explicit embeddings, so Chroma does not download an embedding model.
- The
latesttag is convenient but not reproducible; pin a version if you need stability. - Data persists in the
chroma-datavolume becauseIS_PERSISTENT=TRUE. - Port 8000 is also used by the Databend lab in this collection; do not run both at once unless you change one port.
This lab publishes its ports on 127.0.0.1 only. To use it from another country, do not open the database port to the internet. Pick one:
- VPS + private tunnel: run the lab on a small Ubuntu VPS, keep the port closed, and connect through WireGuard or
ssh -L. - Managed service: use a managed free tier for this engine and point the same examples at its connection string.
- HTTP UI only: if the engine has a web UI, put it behind Caddy with TLS and basic auth.
The shared checklist, provider map, and commands are in REMOTE-ACCESS.md.
docker compose down -v-v also removes the named volume, so the next start is a clean slate.
Part of the database-labs collection: 26 database engines, one index.
MIT (c) 2026 Arya Fatthurahman. See LICENSE.