This guide will walk you through deploying Ollama and Open-WebUI using Docker Compose. Whether you’re writing poetry, generating stories, or experimenting with creative content, this setup will help you get started with a locally running AI!!
Details on Ollama can also be found via their GitHub Repository here: Ollama
Ensure that you have the following prerequisites:
- Docker and Docker Compose installed on your system.
You can install Ollama directly using this link for Windows, MacOS, or Linux.
For OpenWebUI, follow the official documentation.
Create two folders. Name one ollama
and name the other openwebui
.
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
ports:
- "11434:11434"
volumes:
- ollama:/root/.ollama
restart: unless-stopped
volumes:
ollama:
services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
ports:
- "3000:8080"
volumes:
- open-webui:/app/backend/data
extra_hosts:
- "host.docker.internal:host-gateway"
restart: always
volumes:
open-webui:
You will have two folders with two different docker-compose.yaml
files:
├── ollama
│ ├── docker-compose.yaml
├── openwebui
│ ├── docker-compose.yaml
Deploy both the Ollama /ollama
and Open-WebUI /openwebui
using Docker Compose:
cd ollama
docker-compose up -d
cd ..
cd openwebui
docker-compose up -d
Once the containers are up and running, you can access Open-WebUI in your web browser using the specified port (e.g., http://localhost:3000). If you access Open-WebUI for the first time, sign up to get started.
To enhance your AI capabilities, you can download various models that focus on different features, such as code generation, storytelling, and more. Here are the steps to download and use additional models with Ollama:
Visit the Ollama Models page to explore the available models. You can find models tailored for different tasks, such as code generation, natural language processing, and more.
Use the Ollama command-line interface (CLI) to download the desired model. For example, to download a model named gemma2:2b
, use the following command:
ollama pull gemma2:2b
Note that for some models, you can actually specify the size (e.g. 2b, 7b, 27b means BILLIONS of parameters!)
After downloading the model, you may need to configure it by creating a model file that specifies the model's parameters, system prompt, and template. Refer to the Ollama documentation for detailed instructions on configuring models.
Once the model is configured, you can run it using the Ollama CLI or integrate it into your applications using the Ollama API. For example, to run the gemma2:2b
model, use the following command:
ollama run gemma2:2b
Feel free to customize the installation according to your server’s specifications and preferences. If you encounter any issues, refer to the official Docker and NVIDIA documentation for troubleshooting tips.