10 Essential Docker Compose Templates for Your Home Server

Published: March 22, 2026 | Category: Docker & Services | Reading time: 20 min

Docker is the backbone of modern home servers. Instead of installing each service manually, you run them in containers — isolated, portable, and easy to manage. Docker Compose makes this even better, letting you define your entire stack in a single file.

These 10 templates cover the essential services most home servers need. Copy, paste, customize the paths and passwords, and you're ready to deploy.

Prerequisites

Before using these templates, ensure you have:

  • Docker and Docker Compose installed
  • A folder for your Docker configs (e.g., `/opt/docker`)
  • Persistent storage directories created
  • Port 80/443 available (or reverse proxy set up)
  • DNS names configured (optional but recommended)

1. Portainer - Container Management

Portainer is a web-based Docker management interface. Instead of using the command line, you can manage containers, images, volumes, and networks through a beautiful UI.

version: '3.8'

services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: unless-stopped
    ports:
      - 9000:9000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

volumes:
  portainer_data:

Access: http://your-server:9000

Notes: First setup requires creating an admin account. Enable authentication and set up SSL certificates if exposing to the internet.

2. Plex - Media Server

Plex is the most popular media server. Organize your movies, TV shows, music, and photos, then stream to any device. It automatically fetches metadata, creates beautiful libraries, and syncs your watch progress.

version: '3.8'

services:
  plex:
    image: plexinc/pms-docker:latest
    container_name: plex
    restart: unless-stopped
    ports:
      - 32400:32400
      - 1900:1900/udp
      - 3005:3005
      - 8324:8324
      - 32469:32469
    environment:
      - PLEX_CLAIM=your-claim-token
      - ADVERTISE_IP=http://your-server-ip
      - PUID=1000
      - PGID=1000
    volumes:
      - /path/to/your/media:/config
      - /path/to/tv:/data/tvshows
      - /path/to/movies:/data/movies
      - /path/to/music:/data/music
      - /path/to/photos:/data/photos

Get Claim Token: https://www.plex.tv/claim

Access: http://your-server:32400

Notes: Requires a Plex Pass account for hardware transcoding. For GPU transcoding, add device mappings to the container.

3. Jellyfin - Plex Alternative (Free)

Jellyfin is a free, open-source media server forked from Emby. It's like Plex but completely free and open-source. No accounts, no paywalls, just your media.

version: '3.8'

services:
  jellyfin:
    image: jellyfin/jellyfin:latest
    container_name: jellyfin
    restart: unless-stopped
    ports:
      - 8096:8096
    environment:
      - PUID=1000
      - PGID=1000
      - UMASK=002
    volumes:
      - /path/to/config:/config
      - /path/to/cache:/cache
      - /path/to/media:/media

Access: http://your-server:8096

Notes: First run walks you through library setup. Hardware transcoding support requires some configuration.

4. Nextcloud - File Sync & Collaboration

Nextcloud is a self-hosted Dropbox/Google Drive alternative. Sync files between devices, share with others, and access from anywhere. Includes calendar, contacts, and office apps.

version: '3.8'

services:
  nextcloud-db:
    image: mariadb:latest
    container_name: nextcloud-db
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=your-root-password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=your-password
    volumes:
      - nextcloud_db:/var/lib/mysql

  nextcloud:
    image: nextcloud:latest
    container_name: nextcloud
    restart: unless-stopped
    ports:
      - 8080:80
    depends_on:
      - nextcloud-db
    environment:
      - MYSQL_HOST=nextcloud-db
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=your-password
    volumes:
      - /path/to/nextcloud/data:/var/www/html/data
      - /path/to/nextcloud/config:/var/www/html/config

volumes:
  nextcloud_db:

Access: http://your-server:8080

Notes: First run requires creating an admin account. Set up reverse proxy with SSL for secure remote access.

5. Bitwarden - Password Manager

Bitwarden is an open-source password manager. Store all your passwords securely, generate strong ones, and sync across devices. Self-hosted version gives you complete control.

version: '3.8'

services:
  bitwarden-db:
    image: bitnami/postgresql:15
    container_name: bitwarden-db
    restart: unless-stopped
    environment:
      - POSTGRESQL_USERNAME=bitwarden
      - POSTGRESQL_PASSWORD=your-db-password
      - POSTGRESQL_DATABASE=bitwarden_vault
    volumes:
      - bitwarden_db:/bitnami/postgresql

  bitwarden:
    image: vaultwarden/server:latest
    container_name: bitwarden
    restart: unless-stopped
    depends_on:
      - bitwarden-db
    environment:
      - DATABASE_URL=postgresql://bitwarden:your-db-password@bitwarden-db/bitwarden_vault
    ports:
      - 8081:80
    volumes:
      - /path/to/bitwarden/data:/data

volumes:
  bitwarden_db:

Access: http://your-server:8081

Notes: Use Vaultwarden (lightweight Bitwarden server) for lower resource usage. Set up SSL and expose only through VPN or reverse proxy.

6. Pi-hole - Network-wide Ad Blocking

Pi-hole blocks ads and trackers at the network level. All devices on your network get ad-blocking automatically. Great for protecting privacy and speeding up page loads.

version: '3.8'

services:
  pihole:
    image: pihole/pihole:latest
    container_name: pihole
    restart: unless-stopped
    ports:
      - 53:53/tcp
      - 53:53/udp
      - 67:67/udp
      - 8082:80
    environment:
      - TZ=Your/Timezone
      - WEBPASSWORD=your-admin-password
      - DNS1=1.1.1.1
      - DNS2=1.0.0.1
    volumes:
      - /path/to/pihole/etc-pihole:/etc/pihole
      - /path/to/pihole/etc-dnsmasq.d:/etc/dnsmasq.d
    cap_add:
      - NET_ADMIN

Access: http://your-server:8082/admin

Notes: Set up as your router's DNS server to filter all traffic. Whitelist domains you need to unblock.

7. Uptime Kuma - Uptime Monitoring

Uptime Kuma is a self-hosted uptime monitoring tool. Monitor your servers, websites, and services. Get alerts when things go down. Beautiful dark UI.

version: '3.8'

services:
  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    restart: unless-stopped
    ports:
      - 3001:3001
    volumes:
      - uptime_kuma:/app/data

volumes:
  uptime_kuma:

Access: http://your-server:3001

Notes: First run sets up admin account. Add monitors for your websites, Docker containers, and external services.

8. Watchtower - Auto-update Containers

Watchtower automatically updates your Docker containers. No more manually pulling images and restarting. Set it and forget it. Great for keeping your server secure.

version: '3.8'

services:
  watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_POLL_INTERVAL=3600
      - WATCHTOWER_INCLUDE_STOPPED=false

Notes: No web UI — runs in background. Set poll interval in seconds. Add specific containers to WATCHTOWER_SCOPE if you don't want to auto-update everything.

9. Nginx Proxy Manager - Reverse Proxy

Nginx Proxy Manager is a web-based reverse proxy with SSL management. Access all your services via domain names instead of ports. Automatic Let's Encrypt SSL certificates.

version: '3.8'

services:
  nginx-proxy-manager:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: nginx-proxy-manager
    restart: unless-stopped
    ports:
      - '80:80'
      - '443:443'
      - '81:81'
    volumes:
      - /path/to/npm/data:/data
      - /path/to/npm/letsencrypt:/etc/letsencrypt

Access: http://your-server:81 (admin/admin)

Notes: Create proxy hosts for each service. DNS names point to your server IP. NPM handles SSL automatically.

10. Home Assistant - Smart Home Automation

Home Assistant is an open-source smart home platform. Connect all your smart devices, create automations, and control everything from one interface. Powerful and extensible.

version: '3.8'

services:
  homeassistant:
    image: ghcr.io/home-assistant/home-assistant:stable
    container_name: homeassistant
    restart: unless-stopped
    privileged: true
    network_mode: host
    environment:
      - TZ=Your/Timezone
    volumes:
      - /path/to/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro

Access: http://your-server:8123

Notes: First run creates account. Requires network_mode: host for Zigbee/Z-Wave dongle support. HACS integration for community add-ons.

Complete Stack Example

Here's a complete docker-compose.yml combining all services (remove what you don't need):

version: '3.8'

services:
  portainer:
    image: portainer/portainer-ce:latest
    container_name: portainer
    restart: unless-stopped
    ports:
      - 9000:9000
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

  plex:
    image: plexinc/pms-docker:latest
    container_name: plex
    restart: unless-stopped
    ports:
      - 32400:32400
    environment:
      - PLEX_CLAIM=your-claim-token
    volumes:
      - /path/to/media:/config
      - /path/to/tv:/data/tvshows
      - /path/to/movies:/data/movies

  nextcloud:
    image: nextcloud:latest
    container_name: nextcloud
    restart: unless-stopped
    ports:
      - 8080:80
    environment:
      - MYSQL_HOST=nextcloud-db
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_PASSWORD=your-password
    volumes:
      - /path/to/nextcloud/data:/var/www/html/data

  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    restart: unless-stopped
    ports:
      - 3001:3001
    volumes:
      - uptime_kuma:/app/data

  watchtower:
    image: containrrr/watchtower:latest
    container_name: watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - WATCHTOWER_CLEANUP=true
      - WATCHTOWER_POLL_INTERVAL=3600

  nginx-proxy-manager:
    image: 'jc21/nginx-proxy-manager:latest'
    container_name: nginx-proxy-manager
    restart: unless-stopped
    ports:
      - '80:80'
      - '443:443'
      - '81:81'
    volumes:
      - /path/to/npm/data:/data
      - /path/to/npm/letsencrypt:/etc/letsencrypt

volumes:
  portainer_data:
  uptime_kuma:

Best Practices

  • Use Environment Variables: Don't hardcode passwords in compose files. Use .env files or Docker secrets.
  • Set Up Reverse Proxy: Nginx Proxy Manager or Traefik for SSL and domain-based routing.
  • Monitor Resources: Use Portainer or other monitoring to check CPU, RAM, and disk usage.
  • Back Up Data: Regular backups of volumes. Restic, Borg, or automated scripts.
  • Auto-Update Carefully: Watchtower is great, but test major updates before rolling out.
  • Security: Don't expose services directly to the internet. Use VPN or reverse proxy with authentication.
  • Organize: Create separate compose files for different services. One file for media, one for monitoring, etc.

Getting Started

  1. Choose services you want to run
  2. Create directories for persistent storage
  3. Create docker-compose.yml with your chosen services
  4. Customize paths, passwords, and ports
  5. Run docker-compose up -d
  6. Access each service via its port or domain name

Conclusion

These 10 Docker Compose templates give you a complete home server stack. Media serving, file syncing, password management, ad blocking, monitoring, and smart home automation — all in containers, easily manageable.

Start with what you need, add more over time. The beauty of Docker is how easy it is to spin up and tear down services. Your home server will be powerful, organized, and maintainable.

Happy containerizing!

Affiliate Disclosure: This article contains affiliate links. If you click through and make a purchase, I may earn a commission at no additional cost to you. I only recommend services and tools I personally use.