A simple, and above all affordable way to use artificial intelligence today is to run it right on your own machine. If you're lucky enough to have a computer with a GPU packing 6 GB of VRAM or more, you already have all the hardware you need to run seriously capable AI models.

Interface d'Open WebUI

The best part? You can do it for free, using open-source tools, and most importantly: while keeping 100% of your data private. At a time when more and more companies are banning public AI tools (like Gemini, ChatGPT, or Claude) out of fear of leaking source code or sensitive data, having your own local instance completely offline gives you real peace of mind.

To get around those corporate restrictions, we're going to play Lego a bit: Docker (or Podman), Ollama (to run the models), and Open WebUI (for the web interface).

Podman vs Docker: The secure alternative

Before diving into the config files, let's talk about the container engine. Docker is still the industry standard, but if you care about security or work in a locked-down environment, Podman is a fantastic alternative.

Podman's main advantage is that it's daemonless (no heavy background service) and rootless (containers can run without admin privileges). Installing it on Ubuntu is dead simple:

Bash
sudo apt update
sudo apt install podman podman-compose podman-docker

The ecosystem is so compatible that you can usually set an alias docker=podman and forget you even switched tools. That said, for this tutorial our scripts will point to Docker, though the logic is identical.

The architecture: The docker-compose.yml

To deploy your stack easily, we'll use "Docker" Compose. Here is the file that defines your architecture:

YAML
services:
  ollama:
    volumes:
      - ./ollama-data:/root/.ollama
    container_name: ollama
    tty: true
    restart: unless-stopped
    image: docker.io/ollama/ollama:latest
    ports:
      - 127.0.0.1:11434:11434
    environment:
      - OLLAMA_KEEP_ALIVE=24h
    networks:
      - ollama-docker
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all 
              capabilities: [gpu]

  openwebui:
    image: ghcr.io/open-webui/open-webui:cuda
    restart: unless-stopped
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]      
    ports:
      - "127.0.0.1:3000:8080"
    networks:
      - ollama-docker      
    volumes:
      - ./webui-data:/app/backend/data

networks:
  ollama-docker:
    external: false

There are four key details in this configuration:

  1. GPU access: The deploy.resources.reservations.devices section with the nvidia driver lets your containers use your graphics card. Open WebUI uses the :cuda image to accelerate the selected models locally.
  2. Keeping models in memory: The OLLAMA_KEEP_ALIVE=24h environment variable is borderline magic. By default, Ollama unloads a model from VRAM after 5 minutes of inactivity. This variable keeps the model loaded for 24 hours so you don't have to wait 10 seconds on your next prompt.
  3. Linking WebUI and Ollama: Both services are attached to the same ollama-docker virtual network. Open WebUI knows how to find Ollama when they share a network, ensuring smooth communication without exposing Ollama's API to the rest of your local network (note the 127.0.0.1 on the ports).
  4. Volumes: Data and models are saved in the same folder and persist across sessions and reboots.

Simplifying management with control.sh

Even if you love hammering out Docker commands like a maniac, having a control script makes your day-to-day operations much easier and more consistent. Here is control.sh, a dead-simple Bash wrapper:

Bash
#!/usr/bin/env bash
set -euo pipefail

# Constants
SCRIPT_NAME=$(basename "$0")
readonly SCRIPT_NAME
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
readonly SCRIPT_DIR
readonly LOG_FILE="${SCRIPT_DIR}/control.log"

# Global Variables
: "${VERBOSE:=false}"

# --- Core Functions ---
log() {
    local level="${1:-INFO}"
    shift
    local timestamp
    timestamp=$(date '+%Y-%m-%d %H:%M:%S')
    local message="[$timestamp] [$level] $*"

    echo -e "$message"
    echo "$message" >> "$LOG_FILE"
}

info() { log "INFO" "$*"; }
error() { log "ERROR" "$*" >&2; exit 1; }
debug() {
    if [[ "$VERBOSE" == "true" ]]; then
        log "DEBUG" "$*"
    fi
}

cleanup() {
    local exit_code=$?
    if [[ $exit_code -ne 0 ]]; then
        log "ERROR" "Script exited with error code $exit_code"
    fi
}
trap cleanup EXIT

check_dependencies() {
    debug "Checking dependencies..."
    for cmd in docker docker-compose; do
        if ! command -v "$cmd" &> /dev/null; then
            if [[ "$cmd" == "docker-compose" ]]; then
                if ! docker compose version &> /dev/null; then
                    error "Dependency missing: $cmd (or docker compose plugin)"
                fi
            else
                error "Dependency missing: $cmd"
            fi
        fi
    done
}

show_help() {
    cat << EOF
Usage: $SCRIPT_NAME [OPTIONS] [COMMAND] [ARGS...]

Manage Docker Compose services for Ollama.

Options:
    -v, --verbose   Enable verbose logging
    -h, --help      Show this help message

Commands:
    start       Start services (creates and starts containers)
    stop        Stop services (stops containers without removing them)
    down        Stop and remove containers, networks, and volumes
    update      Pull latest images and recreate containers
    restart     Restart services (stops and recreates containers)
    logs        Show logs
    ollama      Run an Ollama command (e.g., list, pull, rm)
    help        Show this help message

Examples:
    $SCRIPT_NAME start
    $SCRIPT_NAME -v update
    $SCRIPT_NAME ollama list
    $SCRIPT_NAME ollama pull llama3

EOF
}

# --- Service Commands ---
start_services() { info "Starting services..."; docker compose up -d; }
stop_services() { info "Stopping services..."; docker compose stop; }
down_services() { info "Stopping and removing services..."; docker compose down; }
update_services() { info "Updating services..."; docker compose pull; docker compose up -d --force-recreate; }
restart_services() { info "Restarting services..."; docker compose down; docker compose up -d --force-recreate; }
show_logs() { info "Showing logs..."; docker compose logs -f; }

run_ollama() {
    local cmd="$1"
    shift
    info "Running Ollama command: $cmd $*"

    if docker ps --filter "name=ollama" --filter "status=running" | grep -q ollama; then
        debug "Ollama container is running. Executing command..."
        docker exec -it ollama ollama "$cmd" "$@"
    else
        error "Ollama container is not running. Start services first."
    fi
}

# --- Main Logic ---
main() {
    cd "$SCRIPT_DIR"
    while [[ $# -gt 0 ]]; do
        case "$1" in
            -v|--verbose) VERBOSE=true; shift ;;
            -h|--help) show_help; exit 0 ;;
            *) break ;;
        esac
    done

    check_dependencies
    if [[ $# -eq 0 ]]; then show_help; return 0; fi

    local command="$1"
    shift

    case "$command" in
        start)   start_services ;;
        stop)    stop_services ;;
        down)    down_services ;;
        update)  update_services ;;
        restart) restart_services ;;
        logs)    show_logs ;;
        ollama)  run_ollama "$@" ;;
        help)    show_help ;;
        *) echo "Error: Unknown command '$command'"; show_help; exit 1 ;;
    esac
}

main "$@"

Once you make the script executable (chmod +x control.sh), you can spin up your entire stack simply by running ./control.sh start.

For me, though, the real perk is the built-in ollama command. Instead of having to look up the container ID and run docker exec, you can just type ./control.sh ollama pull gemma4:e2b to download a model.

Several commands are available, including updating your software…

Bash
$ ./control.sh update
[2026-04-12 11:42:31] [INFO] Updating services...
[+] pull 6/6
 ✔ Image ghcr.io/open-webui/open-webui:cuda Pulled                                        0.3s
 ✔ Image docker.io/ollama/ollama:latest     Pulled                                      228.4s
[+] up 2/2
 ✔ Container ollama-openwebui-1 Started                                                   4.0s
 ✔ Container ollama             Started                                                   4.0s

Don't forget to configure the connection in WebUI properly, just in case:

Configuration de la connexion entre Open WebUI et Ollama

Oh! To access the app, just head over to http://localhost:3000/. Personally, I use a Firefox add-on called PWAs for Firefox, which makes the whole thing feel like a native desktop app on Linux.

Recommended free, high-performing models

Having the infrastructure is great, but which models should you actually run when you have 6 GB of VRAM? Here are a few of my personal favourites:

  • gemma4:e2b: Perfect for machines with limited resources. This optimized model (2.3 billion effective parameters) is built specifically for devices like laptops, yet packs impressive punch… whether for coding or just about anything else, it's my go-to default model.
  • glm-ocr:latest: A surgical tool. With only 0.9 billion parameters, this model excels at optical character recognition (OCR) and understanding complex documents from images. Ideal for scanning invoices or extracting sensitive data.
  • ministral-3:8b: Mistral continues to impress with its Ministral 3 family, designed for local deployment. The 8B version strikes a great balance between memory footprint and reasoning ability. I use it when I want a second opinion from time to time.
  • llama3.1:8b: For quick, straightforward prompts; great for polishing French or English text without eating up too much memory.

To install them once your services are up and running:

Bash
./control.sh ollama pull gemma4:e2b
./control.sh ollama pull glm-ocr:latest
./control.sh ollama pull ministral-3:8b
./control.sh ollama pull llama3.1:8b

Wrapping up

All in all, the setup we just put together is a great example of efficiency, and most importantly, simplicity. By snapping together free, open-source software, you end up with an interface worthy of the best commercial tools, powered straight by your own graphics card.

You can work offline, and best of all, you know for a fact that nothing ever leaves your machine.