← All articlesCloud Infrastructure

Running Docker in Proxmox LXC: Complete Guide and Best Practices

How to run Docker efficiently inside Proxmox LXC containers. Nesting, storage, GPU passthrough, networking, and production-ready configuration.

Y
Yash Pritwani
13 min read

Why Docker in LXC (Not a VM)

LXC containers share the host kernel, making them dramatically lighter than VMs:

OrchestratorNode 1Container AContainer BNode 2Container CContainer ANode 3Container BContainer D

Container orchestration distributes workloads across multiple nodes for resilience and scale.

Aspect LXC VM
Boot time 1-2 seconds 30-60 seconds
RAM overhead ~0MB 512MB-2GB
Disk overhead ~0GB 2-20GB
Performance Near-native 5-10% overhead

Running Docker inside an LXC container gives you the best of both worlds: lightweight containerization (LXC) with application-level packaging (Docker).

Configuration

LXC Config (Proxmox)

Get more insights on Cloud Infrastructure

Join 2,000+ engineers who get our weekly deep-dives. No spam, unsubscribe anytime.

# /etc/pve/lxc/100.conf
arch: amd64
cores: 7
memory: 14336
swap: 88064
unprivileged: 1
features: nesting=1,keyctl=1

Key settings:

  • nesting=1: Required for Docker
  • keyctl=1: Required for certain Docker features
  • unprivileged: Better security
ProductionWeb ServerApp ServerDatabaseMonitoringStagingWeb ServerApp ServerDatabaseVLANBackupStorage3-2-1 Rule

Server infrastructure: production and staging environments connected via VLAN with offsite backups.

Docker Data Root

Move Docker's data directory to a dedicated mount point for better I/O:

{
  "data-root": "/mnt/containers/docker"
}

GPU Passthrough

For AI/ML workloads, pass the GPU to the LXC container:

lxc.cgroup2.devices.allow: c 195:* rwm
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file

Common Issues

  1. AppArmor conflicts: Remove AppArmor inside LXC for Docker compatibility
  2. PID namespace: Create /run/pve directory if missing
  3. Storage drivers: Use overlay2 (default) on ext4 or xfs
  4. safe.directory: Files pushed via pct have different ownership — use git safe.directory
docker-compose.ymlWeb AppAPI ServerDatabaseCacheDocker Network:3000:8080:5432:6379

Docker Compose defines your entire application stack in a single YAML file.

Free Resource

Free Cloud Architecture Checklist

A 47-point checklist covering security, scalability, cost optimization, and disaster recovery for production cloud environments.

Download the Checklist

Our Production Setup

TechSaaS runs Docker inside a single LXC container (CT 100) on Proxmox:

  • 7 cores, 14GB RAM, 88GB swap
  • 50+ Docker containers
  • GPU passthrough for AI workloads
  • NVIDIA Container Toolkit for GPU containers
  • Docker data on dedicated SSD LVM volume

This setup handles all our production services with room to spare. The entire company runs on a single Proxmox node.

Need help with Proxmox + Docker infrastructure? Contact [email protected].

#proxmox#lxc#docker#virtualization#infrastructure

Related Service

Cloud Solutions

Let our experts help you build the right technology strategy for your business.

Need help with cloud infrastructure?

TechSaaS provides expert consulting and managed services for cloud infrastructure, DevOps, and AI/ML operations.

We Will Build You a Demo Site — For Free

Like it? Pay us. Do not like it? Walk away, zero complaints. You will spend way less than hiring developers or any agency.

47+ companies trusted us
99.99% uptime
< 48hr response

No spam. No contracts. Just a free demo.