๐ English | Italiano
A comprehensive Docker Compose project for creating, customizing, and managing Ollama models. Everything you need to work with lightweight local language models in a containerized environment, from basic customization to advanced model management.
- Docker Compose Setup: Easy-to-use containerized Ollama environment
- ๐ Chat Web UI: Modern web interface at
http://localhost:8080 - ๐ง Modelfile Wizard: Guided model creation at
http://localhost:8080/wizard - ๐ Spreadsheet Converter: Convert Excel/CSV to JSONL training format
- ๐ Model Pulling UI: Pull models from Ollama library with real-time progress
- ๐ Example Modelfiles: Pre-configured templates for common use cases
- ๐ ๏ธ Helper Scripts: Convenient automation for common tasks
- ๐จ Model Customization: Adjust parameters, prompts, and behavior
- ๐พ Import/Export: Share and version control your custom models
- โก GPU Support: Optional NVIDIA GPU acceleration via
make up-gpu - ๐ฟ Persistent Storage: Models survive container restarts
New to Ollama? Read Essential Concepts first (5 min read).
git clone https://github.com/manzolo/ollama-model-train-guide.git
cd ollama-model-train-guide
make preflight # 1. Check system requirements
make setup # 2. Create .env and directories
make up # 3. Start Ollama + Chat UI
make create-model # 4. Create your first custom model (interactive)Then pull a base model and start chatting:
docker compose exec ollama ollama pull llama3.2:1b
open http://localhost:8080That's it! ๐
Also browsable as a website at https://manzolo.github.io/ollama-model-train-guide/ (built with MkDocs from docs/).
Suggested reading order: start with Concepts, then follow the table top to bottom. Reference docs can be read as needed.
| # | Document | What it covers |
|---|---|---|
| 1 | Essential Concepts โญ | Models, Modelfiles, parameters, choosing a base model, which method to use โ start here |
| 2 | Installation Guide | Prerequisites, setup, .env configuration, GPU support |
| 3 | Chat Web UI | Web interface: chat, model management, converter, Modelfile wizard |
| 4 | Customization Guide | System prompt vs few-shot vs fine-tuning โ pick the right method |
| 5 | Parameter Guide | Copy-paste parameter presets and tuning advice (canonical reference) |
| 6 | Example Modelfiles | Pre-configured templates: chatbot, code assistant, translator, support bot |
| 7 | Usage Guide | Day-to-day CLI commands and model operations |
| 8 | Quick Reference | Command cheat sheet and interactive menus |
| 9 | Personal Model Guide | Build a personalized assistant that knows your own information |
| 10 | Dataset Training Example | End-to-end example: build a support bot from a Q&A dataset |
| 11 | Fine-Tuning Guide | Deep-dive: fine-tune externally (Unsloth/HF), export GGUF, import into Ollama |
| 12 | Modelfile Reference | Complete Modelfile syntax reference |
| 13 | API Usage Guide | Ollama REST API documentation |
| 14 | Deployment Guide | Save, transfer, and deploy models between instances |
| 15 | Advanced Usage | Templates, LoRA adapters, performance, monitoring, security |
| 16 | Troubleshooting | Common issues and solutions |
make up starts a Flask web app alongside Ollama with three pages:
- Chat: http://localhost:8080 โ chat with any installed model, pull new models with real-time progress, create/edit Modelfiles
- Converter: http://localhost:8080/converter โ convert Excel/CSV spreadsheets to JSONL training data
- Wizard: http://localhost:8080/wizard โ guided 6-step Modelfile creation: pick a use case, base model, personality, rules, and examples, then create the model in one click
See the Chat UI Guide for details. To run Ollama without the web UI, use make up-core.
ollama-model-train-guide/
โโโ docker-compose.yml # Services: Ollama + Chat UI (profile "chat")
โโโ docker-compose.gpu.yml # NVIDIA GPU override (make up-gpu)
โโโ .env # Ports, profiles, Ollama image tag
โโโ Makefile # Convenient commands
โโโ LICENSE # MIT license
โโโ chat/ # Web UI application
โ โโโ app.py # Flask app (chat + converter + wizard)
โ โโโ templates/ # HTML templates
โโโ models/
โ โโโ examples/ # Pre-configured Modelfiles
โ โโโ custom/ # Your custom Modelfiles
โ โโโ saved/ # Exported models
โโโ data/
โ โโโ gguf/ # External GGUF files
โ โโโ adapters/ # LoRA adapters
โ โโโ training/ # Training datasets
โโโ scripts/ # Helper scripts (shared library in scripts/lib/)
โโโ docs/ # Documentation
make preflight # Check system requirements
make setup # Initial setup (creates .env)
make up # Start services (Ollama + Chat UI)
make up-core # Start Ollama only (no web UI)
make up-gpu # Start with NVIDIA GPU support
make down # Stop services
make restart # Restart all services
make logs # View logsmake pull-base # Pull common base models
make create-model # Create custom model (interactive)
make chat # Chat with a model (interactive)
make list-models # List all models
make save-model # Save model for deployment (interactive)
make deploy-model # Deploy saved model (interactive)
make publish-model # Publish model to external registry (interactive)
make backup-models # Backup all custom models
make export-full # Export model WITH weights to tar (interactive)
make import-full # Import a full model archive (interactive)make quick-test # Quick end-to-end test
make test # Run validation testsOpen http://localhost:8080, select a model, and start chatting โ or use make chat from the CLI. See the Chat UI Guide.
- Wizard (easiest): open http://localhost:8080/wizard and follow the steps
- Interactive CLI:
make create-modeland pick a template - From scratch: write a Modelfile in
./models/custom/my-model/and runbash scripts/create-custom-model.sh my-model ./models/custom/my-model/Modelfile
See Example Modelfiles and the Modelfile Reference.
Open http://localhost:8080, click "Manage Models", enter a name (e.g. llama3.2:1b), and watch real-time progress. Browse models at the Ollama Library.
Open http://localhost:8080/converter, upload an Excel/CSV file, map the question/answer columns, and download or save the JSONL. See Chat UI Guide - Converter.
Prepare a JSONL dataset (or use the converter), add MESSAGE examples to a Modelfile, create the model, and iterate. See the Dataset Training Example and, for real fine-tuning, the Fine-Tuning Guide.
# 1. Create a Modelfile
mkdir -p ./models/custom/my-bot
cat > ./models/custom/my-bot/Modelfile << 'EOF'
FROM llama3.2:1b
PARAMETER temperature 0.7
PARAMETER num_ctx 4096
SYSTEM """
You are a friendly customer service assistant for ACME Corp.
Be helpful, professional, and concise.
"""
MESSAGE user "What are your hours?"
MESSAGE assistant "We're open Monday-Friday, 9am-6pm EST."
EOF
# 2. Create the model
bash scripts/create-custom-model.sh my-bot ./models/custom/my-bot/Modelfile
# 3. Test it
docker compose exec ollama ollama run my-bot "Hello!"
# 4. Use in Web UI: open http://localhost:8080 and select "my-bot"make quick-test # Quick end-to-end test
make test # Validation tests
bash scripts/test-techcorp-example.sh # Test TechCorp dataset exampleGitHub Actions automatically run tests on every push. See .github/workflows/README.md for CI/CD details.
Having issues? Check the Troubleshooting Guide for solutions to service startup problems, model creation errors, API connection issues, performance problems, disk space, and GPU configuration.
Enable NVIDIA GPU acceleration for 5-10x faster inference:
# 1. Install the NVIDIA Container Toolkit (see installation guide)
# 2. Start with the GPU override
make up-gpuThis layers docker-compose.gpu.yml on top of the base compose file โ no editing of docker-compose.yml required. See Installation Guide - GPU Support.
Contributions are welcome! Add example Modelfiles, improve documentation, report issues, or suggest enhancements. All pull requests are automatically tested via GitHub Actions.
Remove all containers and volumes (deletes all models):
make cleanThis project is released under the MIT License โ see LICENSE.
Get started now: make preflight && make setup && make up then open http://localhost:8080
This project is part of manzolo's Local AI Lab โ a family of self-hosted AI projects (LLM, voice, vision & documents) that share the same conventions and can be wired together through the shared local-ai-net Docker network.
Explore the whole family: topic:local-ai