Essential Docker Compose Templates for Homelab 2026: Self-Hosted Services Made Easy
Published: April 2026 | Reading Time: 12 minutes
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
- Use port ranges consistently: DNS at 53, web services at 80/443, apps at high ports (8123, 32400)
- Pin image versions in production:
:latestbreaks at the worst times — use:ltsor specific SHA tags - Schedule daily config backups to Git:
0 3 * * * tar czf backup-$(date +\%F).tar.gz /path/to/compose/*.yml - Use Watchtower for auto-updates: It checks for new images daily and gracefully restarts containers
- Separate networks for IoT vs. trusted: Keep Home Assistant on an isolated Docker network, expose only the reverse proxy
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.