This guide explains how to set up and run Weaviate in a Docker container on macOS. It also covers installing dependencies and verifying the setup.
Ensure you have the following installed on your macOS system:
- Docker (Download Here)
- Python 3.8+ (Download Here)
To check if Docker is installed, run:
docker --versionIf Docker is not installed, download and install it from the link above.
Run the following command to pull and start Weaviate with OpenAI text vectorization:
docker run -d --name weaviate \
-e PERSISTENCE_DATA_PATH=/var/lib/weaviate \
-e OPENAI_APIKEY= "<your-openai-key>" \
-e ENABLE_MODULES=text2vec-openai \
-e QUERY_DEFAULTS_LIMIT=25 \
-e AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true \
-p 8080:8080 -p 50051:50051 semitechnologies/weaviate:latest Replace <your-openai-key> with your OpenAI API key.
To verify Weaviate is running, execute:
docker ps | grep weaviateYou should see a running Weaviate container.
To interact with Weaviate, install the required Python packages:
pip install weaviate-clientTo verify installation:
python -c "import weaviate; print('Weaviate client installed successfully')"Create a Python script (test_weaviate.py) to verify connectivity:
import weaviate
client = weaviate.Client("http://localhost:8080")
if client.is_ready():
print("✅ Weaviate is ready!")
else:
print("❌ Weaviate is not running. Check Docker container.")Run the script:
python test_weaviate.pyIf successful, you should see:
✅ Weaviate is ready!To stop Weaviate, run:
docker stop weaviateTo restart Weaviate, run the original docker run command again.
Run:
open -a DockerWait for Docker to fully start, then retry running Weaviate.
Check if another process is using port 8080:
lsof -i :8080If occupied, stop the process or run Weaviate on a different port (-p 9090:8080).
If you're finished with Weaviate or other Docker containers, follow these steps to clean up your system and free up disk space.
-
Find the running Weaviate container:
docker ps
- Look for a container with the name or image related to Weaviate (e.g.,
weaviate/weaviate).
- Look for a container with the name or image related to Weaviate (e.g.,
-
Stop the Weaviate container:
docker stop <container_id>
- Replace
<container_id>with the actual container ID from thedocker pscommand.
- Replace
-
Remove the stopped Weaviate container:
docker rm <container_id>
- This removes the container instance but not the image.
If you want to remove the Weaviate image, run:
docker imagesFind the Weaviate image ID and remove it:
docker rmi <image_id>To delete any Docker networks associated with Weaviate:
docker network pruneTo delete any Docker volumes associated with Weaviate:
docker volume pruneIf you want to completely clean up all stopped containers, unused images, networks, and volumes, run:
docker system prune -aTo check that Weaviate is gone:
docker ps -a # Should not list Weaviate
docker images # Should not list Weaviate imageNow, your system is clean and free of Docker leftovers!
You now have Weaviate running in Docker on macOS. Next, you can:
- Load data into Weaviate
- Perform vector searches
- Integrate with AI models for semantic retrieval
For more details, visit Weaviate Documentation.