---
title: Recettes Docker Compose
created: 2026-06-06
updated: 2026-06-06
type: recipe
tags: [docker, automation, auto-hébergement]
confidence: high
contested: false
sources: [synthesized]
---
# 📋 Recettes Docker Compose

Snippets prêts à l'emploi pour vos stacks personnelles.

## 1. Reverse Proxy Traefik + Service de Base
```yaml
services:
  traefik:
    image: traefik:v3.0
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./letsencrypt:/letsencrypt
    command:
      - "--providers.docker=true"
      - "--entrypoints.websecure.http.tls=true"
      - "--certificatesresolvers.letsencrypt.acme.email=ton@email.com"
      - "--certificatesresolvers.letsencrypt.acme.storage=/letsencrypt/acme.json"

  mon-app:
    image: nginx:alpine
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.monapp.rule=Host(`app.example.com`)"
      - "traefik.http.routers.monapp.entrypoints=websecure"
      - "traefik.http.routers.monapp.tls.certresolver=letsencrypt"
```

## 2. Stack IA Locale (Ollama + Open WebUI)
```yaml
services:
  ollama:
    image: ollama/ollama
    container_name: ollama
    ports:
      - "11434:11434"
    volumes:
      - ollama_data:/root/.ollama
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    restart: unless-stopped

  open-webui:
    image: ghcr.io/open-webui/open-webui:main
    container_name: open-webui
    ports:
      - "3000:8080"
    environment:
      - OLLAMA_BASE_URL=http://ollama:11434
    volumes:
      - openwebui_data:/app/backend/data
    depends_on:
      - ollama
    restart: unless-stopped

volumes:
  ollama_data:
  openwebui_data:
```

## 3. Sauvegarde Restic Automatisée
```yaml
services:
  restic-backup:
    image: mazzolino/restic-cron
    environment:
      - RESTIC_REPOSITORY=sftp:user@nas:/backups/maison
      - RESTIC_PASSWORD=<mot_de_passe_fort>
      - BACKUP_CRON=0 3 * * *  # Tous les jours à 3h du matin
      - BACKUP_NAMES=vol1,vol2
      - NFS_HOST=nas.local
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
```

## Liens
- [[docker]], [[traefik]], [[ollama]], [[restic]]
- Concepts : [[securisation-home-lab]], [[stack-ia-maison]]
- [[deploiement-solo-dev]]
