coffreobsidian/inbox/Multi_Ollama_Config_Docker_Memo.md
2025-03-28 16:18:37 +01:00

138 lines
3.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 🐳 Configuration Multi-Ollama via Docker (pour Ragflow multi-modèle)
Ce fichier te guide pour lancer plusieurs instances dOllama via **Docker Compose**, afin davoir **un modèle dédié par rôle** (chat, vision, embedding, rerank).
Cela permet :
✅ Déviter que les modèles se déchargent entre eux
✅ Davoir une instance stable pour chaque rôle dans **Ragflow Web**
✅ Dexploiter pleinement ta machine (ex : H100)
---
## ⚙️ Structure recommandée
| Rôle | Modèle Ollama | Port |
|-------------|----------------------------------------|------|
| Chat | `deepseek-r1:70b-llama-distill-q8_0` | 11434 |
| Vision | `llava:34b-v1.6-fp16` | 11435 |
| Embedding | `nomic-embed-text` | 11436 |
| Reranker | `bge-reranker-v2-m3` | 11437 |
---
## 📁 Arborescence
```bash
multi-ollama/
├── docker-compose.yml
├── ollama-chat/
│ └── Modelfile (optionnel)
├── ollama-vision/
│ └── Modelfile
├── ollama-embed/
│ └── Modelfile
└── ollama-rerank/
└── Modelfile
```
---
## 🛠️ docker-compose.yml (exemple)
```yaml
version: '3.8'
services:
ollama-chat:
image: ollama/ollama
ports:
- "11434:11434"
environment:
- OLLAMA_HOST=0.0.0.0:11434
volumes:
- ollama-chat-data:/root/.ollama
restart: unless-stopped
ollama-vision:
image: ollama/ollama
ports:
- "11435:11434"
environment:
- OLLAMA_HOST=0.0.0.0:11434
volumes:
- ollama-vision-data:/root/.ollama
restart: unless-stopped
ollama-embed:
image: ollama/ollama
ports:
- "11436:11434"
environment:
- OLLAMA_HOST=0.0.0.0:11434
volumes:
- ollama-embed-data:/root/.ollama
restart: unless-stopped
ollama-rerank:
image: ollama/ollama
ports:
- "11437:11434"
environment:
- OLLAMA_HOST=0.0.0.0:11434
volumes:
- ollama-rerank-data:/root/.ollama
restart: unless-stopped
volumes:
ollama-chat-data:
ollama-vision-data:
ollama-embed-data:
ollama-rerank-data:
```
---
## 🚀 Commandes utiles
Lancer les 4 instances :
```bash
cd multi-ollama
docker compose up -d
```
Vérifier les logs :
```bash
docker compose logs -f
```
Arrêter :
```bash
docker compose down
```
---
## 🔗 Exemple de configuration dans Ragflow Web
| Rôle | Base URL à configurer |
|------------|--------------------------------------|
| Chat | `http://localhost:11434` |
| Vision | `http://localhost:11435` |
| Embedding | `http://localhost:11436` |
| Reranker | `http://localhost:11437` |
---
## 💡 Astuces
- Chaque conteneur a **sa propre cache/modèle** (`.ollama`)
- Tu peux pré-charger les modèles avec :
```bash
docker exec -it <container_name> ollama pull mistral
```
Souhaites-tu une version **avec les modèles directement préchargés via Modelfile** ?