DEV Community

Cover image for Build Your Own Private AI Station: Llama + Open WebUI with Docker
IT Solutions Pro
IT Solutions Pro

Posted on

Build Your Own Private AI Station: Llama + Open WebUI with Docker

๐Ÿ“„ Content (Markdown):
Privacy in AI is no longer a luxury; itโ€™s a necessity. If you are tired of sending your sensitive data to cloud-based LLMs and paying monthly subscriptions, it's time to host your own.

In this guide, I will show you how to deploy Llama 3.1 using Ollama and Open WebUI inside Docker. This setup gives you a ChatGPT-like experience running 100% locally on your hardware.

Why Llama 3.1 + Open WebUI?
Complete Privacy: Your prompts never leave your local network.

Rich UI: Open WebUI provides a professional interface with Markdown support, image generation integration, and document RAG.

Performance: Llama 3.1 (8B) is highly optimized for consumer-grade GPUs like the RTX 30-series or 40-series.

๐Ÿ›  The Stack
Ollama: The engine that runs the model.

Open WebUI: The professional frontend.

Docker: To keep the environment clean and isolated.

Quick Deployment (Docker Compose)
Create a docker-compose.yml file and paste this configuration:

YAML

services:
  ollama:
    volumes:
      - ./ollama:/root/.ollama
    container_name: ollama
    pull_policy: always
    tty: true
    restart: unless-stopped
    image: ollama/ollama:latest

  open-webui:
    build:
      context: .
      args:
        - UID=1000
        - GID=1000
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    volumes:
      - ./open-webui:/app/backend/data
    depends_on:
      - ollama
    ports:
      - 3000:8080
    environment:
      - 'OLLAMA_BASE_URL=http://ollama:11434'
    extra_hosts:
      - "host.docker.internal:host-gateway"
    restart: unless-stopped```



๐Ÿš€ How to Run
Install Docker and Docker Compose.

Run docker-compose up -d.

Access the UI at http://localhost:3000.

Download the model inside the UI by typing llama3.1.

๐ŸŽฅ Full Step-by-Step Masterclass
If you want to see the full installation, including GPU optimization settings, persistent storage configuration, and a tour of the best features, I have recorded a detailed 15-minute Masterclass.

Watch the full tutorial on IT Solutions Pro: 

Conclusion
Running Llama 3.1 locally is a game-changer for developers and IT professionals. Itโ€™s fast, secure, and free.

If you encounter any issues with the Docker configuration, feel free to drop a comment below or on my YouTube channel!

#ai #selfhosted #docker #llama3 #opensource``
Enter fullscreen mode Exit fullscreen mode

Top comments (0)