Table of Contents
Developers working with Weaviate, an open-source vector search engine, often need a local instance for testing and development purposes. Setting up a local Weaviate environment allows for quick iteration, testing, and experimentation without impacting production systems.
Prerequisites
- Docker installed on your machine
- Basic knowledge of command line interface
- Understanding of Weaviate configuration options
Step 1: Install Docker
If you haven't already, download and install Docker from the official website (https://www.docker.com/products/docker-desktop). Follow the installation instructions specific to your operating system.
Step 2: Pull the Weaviate Docker Image
Open your terminal or command prompt and execute the following command to pull the latest Weaviate image:
docker pull semitechnologies/weaviate:latest
Step 3: Run Weaviate Container
Start a new container with the following command, which maps port 8080 on your machine to the container and sets up a basic configuration:
docker run -d -p 8080:8080 \\
-e QUERY_DEFAULTS_LIMIT=20 \\
-e AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true \\
--name weaviate-local \\
semitechnologies/weaviate:latest
Step 4: Verify the Instance
Ensure the container is running by executing:
docker ps
You should see the 'weaviate-local' container listed. You can now access the Weaviate API at http://localhost:8080.
Step 5: Add Data and Test
Use your preferred HTTP client or SDK to interact with the local Weaviate instance. For example, to add data, send a POST request to http://localhost:8080/v1/objects with your data payload.
Optional: Use Docker Compose for Convenience
Create a docker-compose.yml file with the following content for easier management:
version: '3'
services:
weaviate:
image: semitechnologies/weaviate:latest
ports:
- "8080:8080"
environment:
QUERY_DEFAULTS_LIMIT: 20
AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: "true"
Run docker-compose up -d to start the instance.
Conclusion
Setting up a local Weaviate instance is straightforward with Docker. It provides a flexible environment for testing, development, and learning about vector search capabilities. Remember to stop your container when not in use to conserve resources.