Skip to content

Docker Compose Stacks for Your Home Lab: Copy-Paste Setups for Instant Automation

This page may contain affiliate links.

Ever dreamt of a robust home lab, packed with self-hosted services, but felt daunted by the setup process? You're not alone. Building out a sophisticated home lab, whether it's for learning, managing your media, or boosting your network's security, can often feel like a massive undertaking. Installing, configuring, and maintaining multiple applications, each with their own dependencies, quickly becomes a tedious and error-prone faff.

That's where Docker Compose swoops in as your ultimate home lab hero. Imagine deploying entire stacks of interconnected services – a media server with a downloader, a network-wide ad blocker, or a monitoring dashboard – with just a few lines of configuration and a single command. It's not magic; it's the power of Docker Compose. This guide will show you how to leverage copy-paste Docker Compose stacks to transform your home lab from a fiddly project into a streamlined, powerful hub. Let's get cracking!

Why Docker Compose is a Game-Changer for Home Labs

Before diving into the copy-paste goodness, let's briefly understand what Docker Compose is and why it's so brilliant for your home lab. You're probably familiar with Docker, the technology that uses containers to package software and its dependencies into isolated units. This isolation prevents conflicts and makes applications super portable.

Docker Compose takes this a step further. While Docker manages individual containers, Docker Compose allows you to define and run multi-container Docker applications. You describe your entire application stack – all its services, networks, and volumes – in a single YAML file (usually named docker-compose.yml). Then, with one command, Docker Compose brings your entire stack to life.

Here's why this is a game-changer for home lab enthusiasts:

  • Simplicity & Efficiency: Define complex environments in a human-readable file. No more clicking through endless setup wizards or wrestling with dependency hell.
  • Reproducibility: Get the exact same setup every time, across different machines. Great for migrating your lab or starting fresh.
  • Portability: Move your entire service stack from one machine to another with ease. Upgrade your hardware? Just copy your docker-compose.yml files and data volumes.
  • Resource Optimisation: Containers are lightweight, meaning you can run more services on less powerful hardware, like a Raspberry Pi 4 or an Intel NUC.
  • Isolation: Each service runs in its own container, preventing conflicts and making troubleshooting a breeze.
  • Versioning: Your docker-compose.yml file can be tracked with version control (like Git), giving you a clear history of your lab's configuration.

Getting Started: Your Docker Compose Toolkit

To start deploying these amazing stacks, you'll need a few essentials. Don't worry, it's nothing too exotic.

1. Your Home Lab Hardware

You'll need a machine to run Docker on. This could be:

  • A dedicated Raspberry Pi 4 (we recommend at least 4GB RAM, 8GB is even better).
  • An old desktop PC or laptop repurposed as a server.
  • A low-power Mini PC or Intel NUC.
  • A virtual machine (VM) on your desktop or a cloud provider.

Ensure it has a decent amount of storage, ideally an SSD for faster performance and reliability, especially for services with frequent disk I/O.

2. Operating System

We'll assume a Debian/Ubuntu-based operating system (or Raspberry Pi OS, which is Debian-based). These are common, well-supported, and easy to use for home lab purposes.

3. Install Docker Engine & Docker Compose

First, ensure your system is up to date:

sudo apt update && sudo apt upgrade -y

Next, install Docker Engine. The official convenience script is the easiest way:

curl -fsSL https://get.docker.com -o get-docker.shsudo sh get-docker.sh

Add your user to the docker group so you don't need to use sudo for every Docker command:

sudo usermod -aG docker $USERnewgrp docker  # Apply group changes immediately, or log out and back in

Finally, verify Docker is working:

docker run hello-world

Docker Compose is typically included with Docker Desktop, but if you're on a server without a GUI, you'll install the Docker Compose plugin. Modern Docker installations often include it automatically, so you might already have it. Check with:

docker compose version

If it returns a version, you're good to go. If not, follow Docker's official guide to install the plugin, or simply download the binary (often available from GitHub releases).

Basic Docker Compose Usage

Once you have a docker-compose.yml file, navigating your stack is simple:

  • To start your services in the background: docker compose up -d
  • To stop and remove services: docker compose down
  • To view service logs: docker compose logs -f
  • To restart a specific service: docker compose restart [service_name]

Copy-Paste Stacks for Your Home Lab

Now for the exciting part – ready-made Docker Compose stacks you can deploy immediately. For each, create a new directory (e.g., ~/docker/portainer-kuma), place the docker-compose.yml file inside, and run docker compose up -d from that directory.

1. Home Lab Management & Monitoring (Portainer + Uptime Kuma)

This stack gives you a powerful GUI for managing your Docker containers (Portainer) and a fantastic self-hosted monitoring tool to ensure all your services are online (Uptime Kuma).

version: '3.8'services:  portainer:    image: portainer/portainer-ce:latest    container_name: portainer    restart: unless-stopped    security_opt:      - no-new-privileges:true    volumes:      - /var/run/docker.sock:/var/run/docker.sock      - portainer_data:/data    ports:      - '9000:9000'      - '9443:9443' # For HTTPS access  uptime-kuma:    image: louislam/uptime-kuma:1    container_name: uptime-kuma    restart: unless-stopped    volumes:      - uptime-kuma_data:/app/data    ports:      - '3001:3001'volumes:  portainer_data:  uptime-kuma_data:

After deploying, access Portainer at http://your-homelab-ip:9000 to set up an admin user. Access Uptime Kuma at http://your-homelab-ip:3001 to start monitoring your services.

2. Media Server (Jellyfin + qBittorrent)

Set up a complete media server with Jellyfin (an open-source alternative to Plex) and qBittorrent for downloading.

version: '3.8'services:  jellyfin:    image: jellyfin/jellyfin:latest    container_name: jellyfin    restart: unless-stopped    volumes:      - jellyfin_config:/config      - jellyfin_cache:/cache      - /path/to/your/media/movies:/data/movies:ro      - /path/to/your/media/tvshows:/data/tvshows:ro    ports:      - '8096:8096' # Web UI      - '8920:8920' # HTTPS (if enabled)    environment:      - PUID=1000 # Your user ID      - PGID=1000 # Your group ID      - TZ=Europe/London # Your timezone  qbittorrent:    image: lscr.io/linuxserver/qbittorrent:latest    container_name: qbittorrent    restart: unless-stopped    volumes:      - qbittorrent_config:/config      - /path/to/your/downloads:/downloads    ports:      - '8080:8080' # Web UI      - '6881:6881' # BitTorrent traffic      - '6881:6881/udp'    environment:      - PUID=1000      - PGID=1000      - TZ=Europe/Londonvolumes:  jellyfin_config:  jellyfin_cache:  qbittorrent_config:

IMPORTANT: Replace /path/to/your/media/movies, /path/to/your/media/tvshows, and /path/to/your/downloads with actual paths on your host machine. Also, find your PUID and PGID by running id $USER in your terminal. Jellyfin will be on http://your-homelab-ip:8096 and qBittorrent on http://your-homelab-ip:8080 (default user/pass: admin/adminadmin).

3. Network-Wide Ad Blocking (AdGuard Home)

Block ads and trackers for every device on your network. This is a must-have for any home lab.

version: '3.8'services:  adguardhome:    image: adguard/adguardhome    container_name: adguardhome    restart: unless-stopped    volumes:      - adguardhome_work:/opt/adguardhome/work      - adguardhome_conf:/opt/adguardhome/conf    ports:      - '53:53/tcp' # DNS (required)      - '53:53/udp' # DNS (required)      - '80:80/tcp' # Web interface and setup      - '443:443/tcp' # HTTPS (if enabled)      - '3000:3000/tcp' # For initial setup wizard (can be removed later)

CRITICAL: Ensure no other service (like NetworkManager's systemd-resolved) is using port 53 on your host machine before starting this. You might need to disable it. After deployment, navigate to http://your-homelab-ip:3000 to complete the initial setup. Once configured, point your network's DNS to your home lab's IP address.

Feeling overwhelmed by creating these from scratch? Our Home Lab & Automation Pack offers ready-made AI prompts to help you script, troubleshoot, and document your home lab setups in a flash. Think of it as your secret weapon for getting things done even faster, starting from just £9.

4. Self-Hosted Wiki / Knowledge Base (BookStack)

Organise your notes, documentation, and personal knowledge with BookStack, backed by a MariaDB database.

version: '3.8'services:  bookstack:    image: lscr.io/linuxserver/bookstack:latest    container_name: bookstack    restart: unless-stopped    environment:      - PUID=1000      - PGID=1000      - APP_URL=http://your-homelab-ip:80      - DB_HOST=bookstack_db      - DB_DATABASE=bookstackapp      - DB_USERNAME=bookstackuser      - DB_PASSWORD=your_secure_db_password # IMPORTANT: Change this!    volumes:      - bookstack_config:/config    ports:      - '80:80' # Or another port like '8081:80'    depends_on:      - bookstack_db  bookstack_db:    image: mariadb:10.5    container_name: bookstack_db    restart: unless-stopped    environment:      - MYSQL_ROOT_PASSWORD=your_very_secure_root_password # IMPORTANT: Change this!      - MYSQL_DATABASE=bookstackapp      - MYSQL_USER=bookstackuser      - MYSQL_PASSWORD=your_secure_db_password # IMPORTANT: Change this! (Must match BookStack service)    volumes:      - bookstack_db_data:/configvolumes:  bookstack_config:  bookstack_db_data:

Remember to replace your_secure_db_password and your_very_secure_root_password with strong, unique passwords. Access BookStack at http://your-homelab-ip:80 (or your chosen port).

Best Practices and Further Optimisations

As you get more comfortable, consider these tips to make your Docker Compose home lab even more robust:

  • Environment Variables (.env files): For sensitive information like passwords, create a .env file in the same directory as your docker-compose.yml. Define variables (e.g., DB_PASSWORD=your_password) and then reference them in your YAML file like DB_PASSWORD=${DB_PASSWORD}. This keeps sensitive data out of your main config file.
  • Named Volumes for Persistence: As seen in our examples, using named volumes (e.g., bookstack_config:) ensures your data persists even if containers are removed or rebuilt. Avoid binding directly to host paths for all data unless you have a specific reason.
  • Custom Networks: For more complex setups, define custom Docker networks within your docker-compose.yml. This provides better isolation and allows services to communicate by their service names.
  • Restart Policies: Always use restart: unless-stopped or restart: always for production services. This ensures your containers automatically restart if they crash or after a host reboot.
  • Resource Limits: For critical services, consider adding deploy.resources.limits to your service definitions to cap CPU and memory usage, preventing one rogue container from hogging all your home lab's resources.
  • Backups are Paramount: Regularly back up your docker-compose.yml files and, crucially, the data stored in your named volumes. You can find volume paths with docker volume inspect [volume_name].
  • Security First: Keep your Docker images updated (pull new images regularly), use strong, unique passwords for all services, and don't expose unnecessary ports to the internet.
  • Reverse Proxy: For accessing multiple services from outside your home network (e.g., wiki.myhomelab.com, jellyfin.myhomelab.com) with SSL certificates, consider adding a reverse proxy like Nginx Proxy Manager to your stack.

Conclusion

Docker Compose truly simplifies the art of home lab management. By leveraging these copy-paste stacks, you can quickly spin up powerful, custom infrastructure tailored to your needs, all while maintaining a clean, reproducible, and easy-to-manage environment. Gone are the days of wrestling with individual installations and dependencies. Now, with a few commands, you're building a robust, automated home lab that serves your every tech whim.

So, pick a stack, copy the YAML, fire it up, and start experimenting. The world of self-hosted services is at your fingertips, ready to be explored with Docker Compose. Happy labbing!

Written by

Richard Tucker

View all posts →