← Back to Home

Essential Docker Compose Templates for Homelab 2026: Self-Hosted Services Made Easy

Published: April 2026 | Reading Time: 12 minutes

Affiliate Disclosure: This article contains affiliate links. We earn a commission when you purchase through links at no extra cost to you.

Docker Compose is the backbone of every good homelab. Instead of fighting with bare-metal installs or wrestling with virtual machines, you define your services in a YAML file and spin up entire application stacks in seconds. In 2026, the self-hosted ecosystem has never been richer — with official images, community templates, and composable architectures that make running your own internet infrastructure genuinely accessible.

Why Docker Compose Beats Bare Metal for Homelab

Here's the deal: bare-metal installs accumulate configuration debt. You forget what you changed. Dependencies break. Updates brick services. Docker isolates everything — your Home Assistant upgrade can't break your Pi-hole because they're in separate containers with pinned versions.

And with docker-compose.yml checked into Git, your entire homelab configuration is version-controlled and reproducible. New homelab machine? git clone && docker-compose up -d and you're back online.

The Core Stack: Essential Services

Pi-hole DNS Sinkhole

Every homelab starts with Pi-hole. It blocks ads and trackers at the network level — every device on your LAN benefits without any client configuration.

services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    environment:
      WEBPASSWORD: 'change_me'
      TZ: 'America/New_York'
    volumes:
      - ./pihole/etc-pihole:/etc/pihole
      - ./pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "8080:80/tcp"
    restart: unless-stopped
    networks:
      - homelab

networks:
  homelab:
    driver: bridge

Nginx Proxy Manager: TLS Made Effortless

Self-hosted means self-signed certificates — unless you run a reverse proxy that handles Let's Encrypt automatically. Nginx Proxy Manager gives you a web UI to manage hosts, SSL certificates, and access lists.

services:
  nginx-proxy-manager:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: nginx-proxy-manager
    environment:
      DB_MYSQL_HOST: mariadb
      DB_MYSQL_PORT: 3306
      DB_MYSQL_NAME: nginx-proxy-manager
      DB_MYSQL_USER: npm
      DB_MYSQL_PASSWORD: 'change_me'
    volumes:
      - ./npm/data:/data
      - ./npm/letsencrypt:/etc/letsencrypt
    ports:
      - "80:80"
      - "443:443"
      - "81:81"
    depends_on:
      - mariadb
    restart: unless-stopped
    networks:
      - homelab

  mariadb:
    image: 'jc21/mariadb-aria:latest'
    container_name: npm-db
    environment:
      MYSQL_ROOT_PASSWORD: 'change_me'
      MYSQL_DATABASE: nginx-proxy-manager
      MYSQL_USER: npm
      MYSQL_PASSWORD: 'change_me'
    volumes:
      - ./npm/db:/var/lib/mysql
    restart: unless-stopped
    networks:
      - homelab

Home Assistant: The Smart Home Brain

Home Assistant is the independent, privacy-respecting alternative to cloud smart home platforms. It runs locally, supports 2,000+ integrations, and orchestrates everything from Zigbee to Z-Wave to Matter.

services:
  homeassistant:
    image: ghcr.io/home-assistant/home-assistant:stable
    container_name: homeassistant
    environment:
      TZ: America/New_York
    volumes:
      - ./homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "8123:8123"
    devices:
      - /dev/serial/by-id/your-zigbee-stick:/dev/serial/by-id/your-zigbee-stick
    restart: unless-stopped
    network_mode: host
    privileged: true

Plex Media Server: Personal Streaming

services:
  plex:
    image: plexinc/pms-docker:latest
    container_name: plex
    environment:
      PLEX_CLAIM: 'claim-your-claim-token'
      TZ: America/New_York
    volumes:
      - ./plex/config:/config
      - ./plex/transcode:/transcode
      - /path/to/media:/data/media
    ports:
      - "32400:32400"
    restart: unless-stopped
    networks:
      - homelab

Pro Tips for Docker Homelab

Start Small, Stack Up

You don't need to run everything at once. Start with Pi-hole (5 minutes to set up), then add Nginx Proxy Manager when you want external access, then Home Assistant when you're ready to go all-in on smart home. Docker Compose makes every addition additive — your homelab grows organically without reinstalls.