Docker is the most practical way to run a vector database locally or on your own server. You get a self-contained, reproducible environment — no dependency conflicts, no manual installs, and full control over configuration. This guide walks through what deploying a vector database on Docker looks like in practice, then shows a complete example using Weaviate.
What You Need Before You Start
To deploy any vector database on Docker, you need:
- Docker Desktop (Mac/Windows) or Docker Engine (Linux) — version 20.10 or later recommended
- Docker Compose — included with Docker Desktop; install separately on Linux
- Sufficient RAM — most vector databases need at least 4 GB available to Docker; 8 GB+ for production workloads
- Open ports — vector databases typically expose an HTTP API port and optionally a gRPC port
How Docker Deployment Works for Vector Databases
There are two common approaches:
1. Single docker run Command
The fastest way to get running. You pull the image and start the container in one command. Good for local testing and evaluation.
docker run -p <host-port>:<container-port> <image-name>
Drawback: no persistent volume by default, so data is lost when the container stops.
2. Docker Compose
The recommended approach for anything beyond a quick test. A docker-compose.yml file lets you define volumes, environment variables, restart policies, and multi-service setups (e.g. a vector database alongside a local embedding model) in one place.
docker compose up -d
Key Configuration Concepts
Regardless of which vector database you choose, the same Docker configuration concepts apply:
- Port mapping — maps a port inside the container to a port on your host (
host:container) - Volumes — mount a directory or named volume for persistent data storage; without this, data is lost on container restart
- Environment variables — configure authentication, query limits, module settings, and storage paths
- Restart policy —
restart: on-failureorrestart: alwayskeeps the database running after a crash or reboot - Resource limits — use
mem_limitorcpusto cap what Docker allocates
Example Deployment: Weaviate on Docker
The following example uses Weaviate — a fully open-source vector database with built-in support for embeddings, multi-tenancy, and GraphQL. It’s one of the most complete free vector databases available for Docker deployment.
Quick Start: Single Command
To run Weaviate immediately with default settings:
docker run -p 8080:8080 -p 50051:50051 cr.weaviate.io/semitechnologies/weaviate:1.38.0
This sets the following defaults inside the container:
PERSISTENCE_DATA_PATH→./dataAUTHENTICATION_ANONYMOUS_ACCESS_ENABLED→trueQUERY_DEFAULTS_LIMIT→10
Port 8080 serves the HTTP REST and GraphQL API. Port 50051 serves the gRPC API used by modern Weaviate clients.
Production Setup: Docker Compose with Persistent Volume
Save this as docker-compose.yml for a persistent, restart-safe Weaviate instance with anonymous access (suitable for development):
---
services:
weaviate:
command:
- --host
- 0.0.0.0
- --port
- '8080'
- --scheme
- http
image: cr.weaviate.io/semitechnologies/weaviate:1.38.0
ports:
- 8080:8080
- 50051:50051
volumes:
- weaviate_data:/var/lib/weaviate
restart: on-failure:0
environment:
QUERY_DEFAULTS_LIMIT: 25
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
CLUSTER_HOSTNAME: 'node1'
volumes:
weaviate_data:
...
Then start it with:
docker compose up -d
docker-compose.yml.With a Local Embedding Model (text2vec-transformers)
To run Weaviate with a locally hosted sentence-transformer model — no external API key required:
services:
weaviate:
image: cr.weaviate.io/semitechnologies/weaviate:1.38.0
restart: on-failure:0
ports:
- 8080:8080
- 50051:50051
environment:
QUERY_DEFAULTS_LIMIT: 20
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
PERSISTENCE_DATA_PATH: "./data"
DEFAULT_VECTORIZER_MODULE: text2vec-transformers
ENABLE_MODULES: text2vec-transformers
TRANSFORMERS_INFERENCE_API: http://text2vec-transformers:8080
CLUSTER_HOSTNAME: 'node1'
text2vec-transformers:
image: cr.weaviate.io/semitechnologies/transformers-inference:sentence-transformers-multi-qa-MiniLM-L6-cos-v1
environment:
ENABLE_CUDA: 0 # set to 1 if you have a GPU available
This two-service setup runs Weaviate and a transformer inference server side by side. Weaviate handles vectorization automatically at import and query time — no external embedding API needed.
Persistent Volume Options
Weaviate (and most vector databases) support two volume patterns:
Named Volume (Recommended)
volumes:
- weaviate_data:/var/lib/weaviate
volumes:
weaviate_data:
Docker manages the volume location. Easy to reference, portable between machines.
Host Binding
volumes:
- /var/weaviate:/var/lib/weaviate
Mounts a specific host directory. Useful when you need direct filesystem access to the data.
Exposing Weaviate Over a Domain
To access Weaviate via a public domain, configure your reverse proxy (nginx, Caddy, Traefik) to forward to both ports:
weaviate.yourdomain.com→localhost:8080(HTTP REST + GraphQL)grpc-weaviate.yourdomain.com→localhost:50051(gRPC, using h2c)
The grpc- subdomain convention ensures compatibility with all Weaviate client libraries.
Multi-Node Cluster Setup
For horizontal scaling, Weaviate supports multi-node Docker Compose deployments. Each node needs cluster networking variables set:
# Founding node
weaviate-node-1:
environment:
CLUSTER_HOSTNAME: 'node1'
CLUSTER_GOSSIP_BIND_PORT: '7100'
CLUSTER_DATA_BIND_PORT: '7101'
RAFT_JOIN: 'node1,node2,node3'
RAFT_BOOTSTRAP_EXPECT: 3
# Additional nodes
weaviate-node-2:
environment:
CLUSTER_HOSTNAME: 'node2'
CLUSTER_GOSSIP_BIND_PORT: '7102'
CLUSTER_DATA_BIND_PORT: '7103'
CLUSTER_JOIN: 'weaviate-node-1:7100'
RAFT_JOIN: 'node1,node2,node3'
RAFT_BOOTSTRAP_EXPECT: 3
By convention, CLUSTER_DATA_BIND_PORT is set 1 higher than CLUSTER_GOSSIP_BIND_PORT.
Useful Docker Commands
# Start in detached mode and follow Weaviate logs only
docker compose up -d && docker compose logs -f weaviate
# Graceful shutdown (flushes in-memory data to disk)
docker compose down
# Check if Weaviate is ready
curl http://localhost:8080/v1/meta
Always use docker compose down (not docker kill) to shut down — this ensures in-memory data is flushed to the persistent volume.
Frequently Asked Questions
Do I need a GPU to run a vector database on Docker?
No. All major free vector databases run on CPU-only Docker hosts. A GPU accelerates locally hosted embedding models (like text2vec-transformers) but is not required for vector storage and search itself.
Will my data persist if the container restarts?
Only if you configure a volume. Without a volume mount, all data is stored inside the container layer and lost on restart. Always mount a named volume or host directory for any data you want to keep.
How much RAM does a Docker vector database deployment need?
Minimum 4 GB for development. Production workloads with millions of vectors typically need 8–32 GB depending on vector dimensions and index type. Weaviate’s dual-index (HNSW + inverted) uses more memory than simpler libraries like FAISS.
Which free vector database is easiest to deploy on Docker?
Weaviate and Qdrant both have single-command Docker setups and well-maintained images. Weaviate has an edge for teams that want built-in vectorization and a schema-based data model. Qdrant is the better pick when you need the lightest possible footprint and bring your own embeddings.