Proxmox VE Helper Scripts supports both LXC containers (lightweight) and Virtual Machines (full isolation). Understanding when to use each is crucial for optimal performance and security.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/community-scripts/ProxmoxVE/llms.txt
Use this file to discover all available pages before exploring further.
Quick Comparison
| Feature | LXC Containers | Virtual Machines |
|---|---|---|
| Overhead | Minimal (shares host kernel) | Higher (full OS) |
| Boot Time | Seconds | Minutes |
| Resource Usage | Very efficient | More resources |
| Isolation | Process-level | Hardware-level |
| OS Support | Linux only | Any OS |
| Performance | Near-native | Slight overhead |
| Security | Good (with unprivileged) | Excellent |
| Use Case | Linux apps, services | Non-Linux OS, full isolation |
LXC Containers
What Are LXC Containers?
LXC (Linux Containers) are OS-level virtualization that share the host kernel while providing isolated user spaces. They’re similar to Docker containers but designed for running full system services.Think of containers as lightweight isolated environments that share the same kernel but have their own filesystem, processes, and network stack.
Container Architecture
Container Scripts Structure
All container scripts follow a consistent two-file pattern:1. Host Script (ct/*.sh)
Executes on the Proxmox VE host to create the container.Key Elements in Host Scripts
Key Elements in Host Scripts
- APP: Human-readable application name
- var_tags: Categorization tags (used for filtering)
- var_cpu/ram/disk: Resource allocation (defaults)
- var_os: Operating system (debian, ubuntu, alpine)
- var_version: OS version number
- var_unprivileged: Security mode (1=unprivileged, 0=privileged)
- update_script(): Function called when updating existing containers
- build_container: Main function that orchestrates container creation
2. Install Script (install/*-install.sh)
Executes inside the container after creation to install the application.Key Elements in Install Scripts
Key Elements in Install Scripts
- source /dev/stdin: Loads install.func from FUNCTIONS_FILE_PATH
- setting_up_container: Initializes container environment
- network_check: Verifies internet connectivity
- update_os: Updates package lists and base system
- setup_php/setup_mariadb/setup_composer: Helper functions from core.func
- fetch_and_deploy_gh_release: Downloads latest release from GitHub
- motd_ssh: Configures message of the day
- customize: Applies user customizations
- cleanup_lxc: Final cleanup steps
Privileged vs Unprivileged Containers
- Unprivileged (Recommended)
- Privileged (Legacy)
Default mode for all scripts (
var_unprivileged=1)- User ID mapping: Container root (UID 0) maps to host UID 100000
- Better security isolation
- Cannot directly access host devices
- Recommended for most applications
When to Use Containers
Use LXC containers for:
- Linux applications (Debian, Ubuntu, Alpine based)
- Web services (nginx, Apache, databases)
- Docker hosts (running Docker inside LXC)
- Network services (Pi-hole, DNS, VPN)
- Development environments
- Microservices that need fast startup
- Resource-constrained scenarios
Virtual Machines
What Are VMs?
Virtual Machines provide full hardware virtualization with complete OS isolation. Each VM runs its own kernel and can run any operating system.VM Architecture
VM Scripts Structure
VM scripts differ from container scripts as they handle full OS installation:VM scripts do not use install scripts because they boot complete OS images (OVA, QCOW2, ISO). Configuration happens through cloud-init or first-boot scripts.
When to Use VMs
Use Virtual Machines for:
- Non-Linux operating systems (Windows, FreeBSD, pfSense)
- Home Assistant OS (requires full OS control)
- OPNsense/pfSense (firewall appliances)
- Maximum security isolation
- Kernel-level requirements
- Hardware passthrough (GPU, USB devices)
- Testing different kernels
- Legacy applications requiring specific OS versions
Decision Matrix
Use this flowchart to choose between containers and VMs:Performance Comparison
Real-World Examples
Pi-hole (Container)
- Boot time: 3-5 seconds
- Memory: 100MB active
- CPU overhead: Less than 1%
- Disk I/O: Near-native
OPNsense (VM)
- Boot time: 30-60 seconds
- Memory: 1GB minimum
- CPU overhead: 2-5%
- Disk I/O: Slight overhead
Benchmark Summary
| Operation | Container | VM |
|---|---|---|
| Create | 20-40 seconds | 2-5 minutes |
| Start | 2-5 seconds | 30-90 seconds |
| Stop | Instant | 10-30 seconds |
| Backup | Fast (rsync) | Slower (full disk) |
| Restore | Fast | Slower |
| Snapshot | Instant | Quick (storage dependent) |
Migration Considerations
Container to VM
If you need to migrate from container to VM:VM to Container
Downgrading from VM to container:Best Practices
Container Best Practices
Container Best Practices
- Always use unprivileged mode unless absolutely required
- Allocate only necessary resources (easy to increase later)
- Use bind mounts for data persistence
- Enable nesting for Docker-in-LXC
- Configure backups regularly
- Monitor resource usage with pct commands
VM Best Practices
VM Best Practices
- Enable VirtIO drivers for better performance
- Use cloud-init for automated configuration
- Allocate adequate disk space (harder to resize)
- Enable QEMU guest agent
- Use thin provisioning when possible
- Configure NUMA for multi-socket systems
Next Steps
Script Structure
Learn how scripts are organized internally
Architecture
Understand the overall system design