How to Set Up Docker in Your Homelab: A Beginner's Guide
Table of Contents
• How to Set Up Docker in Your Homelab: A Beginner's Guide
• Prerequisites: LXC-Specific Setup
• Step 1: Install Docker Engine
• Step 2: Verify Docker Installation
• Step 3: Configure Docker for Non-Root Usage
• Step 4: Understand Docker Compose
• Basic Docker Compose Structure
• Step 5: Deploy Your First Service
• Step 6: Organise Your Homelab
• Step 7: Using Traefik as a Reverse Proxy
• Step 8: Essential Maintenance Commands
• Troubleshooting: LXC-Specific Errors
• Permission Denied When Starting Docker
• Cgroup Namespace Not Supported
• General Troubleshooting Tips
How to Set Up Docker in Your Homelab: A Beginner's Guide
So you've got your homelab hardware sorted — maybe a Proxmox cluster with LXC containers, a TrueNAS box, or just an old desktop repurposed as a server. Now you want to run services without the headache of managing dependencies, conflicting versions, and system-wide installations. That's where Docker comes in.
• At least 2GB RAM (4GB recommended)
• 10GB free disk space
• Sudo access
This guide walks you through setting up Docker on a typical homelab server, including specific considerations for LXC containers. By the end, you'll have a working Docker installation and understand the core concepts to build from.
Prerequisites: LXC-Specific Setup
If you're running Docker inside an LXC container (common in Proxmox homelabs), you need to enable nesting and keyctl support on the host first.
On your Proxmox host, run:
Verify nesting is enabled inside the LXC with:
You should see Unshare_ns entries. If not, revisit the host configuration.
Why Docker for Homelabs?
Before we dive in, here's why Docker is a homelab game-changer:
• Isolation: Each service runs in its own container with its own dependencies
• Portability: Move containers between hosts without reconfiguration
• Version control: Pin specific versions and roll back easily
• Resource efficiency: Containers share the host kernel, using less overhead than VMs
• Community images: Thousands of pre-built images for common homelab services
Step 1: Install Docker Engine
First, let's get Docker installed on your host system. We'll use the official Docker repository for the latest stable version.
Step 2: Verify Docker Installation
Before proceeding, confirm Docker is working correctly:
Step 3: Configure Docker for Non-Root Usage
Running Docker commands as root is tedious and error-prone. Add your user to the docker group:
Step 4: Understand Docker Compose
For homelabs, you'll rarely run single containers. You'll want multiple services working together — a web server, database, and maybe a reverse proxy. Docker Compose lets you define and manage multi-container applications with a single YAML file.
Basic Docker Compose Structure
Here's a typical structure for a homelab service:
Key Points:
• image: The container image to pull
• volumes: Persist data outside the container
• ports: Map host ports to container ports
• restart: Auto-restart after reboot or crashes
• environment: Pass configuration variables
Step 5: Deploy Your First Service
Let's deploy a practical example: Uptime Kuma, a popular self-hosted monitoring tool.
Step 6: Organise Your Homelab
As you add more services, stay organised:
Create a Shared Network
Create a shared network for inter-container communication:
Step 7: Using Traefik as a Reverse Proxy
For a more advanced setup, Traefik provides automatic SSL and routing:
Step 8: Essential Maintenance Commands
Keep your Docker environment healthy:
Backup Your Docker Services
Container data lives in volumes — back these up regularly:
Troubleshooting: LXC-Specific Errors
Running Docker in LXC? Here are common issues:
Permission Denied When Starting Docker
Cgroup Namespace Not Supported
This means your LXC doesn't have the right features. On the Proxmox host:
AppArmor Profile Not Found
Add this to your LXC config on the host:
Docker0 Bridge Not Created
Next Steps
Now you've got Docker running, here are common homelab services to explore:
• Nginx Proxy Manager: Reverse proxy with Let's Encrypt SSL
• Pi-hole or AdGuard Home: Network-wide ad blocking
• Jellyfin or Plex: Media streaming
• Nextcloud: Self-hosted file sync and share
• Home Assistant: Home automation hub
• Vikunja: Task and project management
Each follows the same pattern: pull an image, configure volumes and environment variables, and deploy with Docker Compose.
General Troubleshooting Tips
• Permission denied errors: Check PUID/PGID match your user (id $USER)
• Port already in use: Change the host port in docker-compose.yml
• Container won't start: Check logs with docker logs container_name
• Can't access service: Verify firewall rules and port mappings
• Docker commands fail without sudo: Run newgrp docker or log out/in
Comments
Join the discussion on "How to Set Up Docker in Your Homelab: A Beginner's Guide"