VMs vs LXCs: When to use what

VMs vs LXCs: When to use what

If you're running a Proxmox environment, you've probably noticed it supports two types of virtualisation: Virtual Machines (VMs) and Linux Containers (LXCs). Both are powerful, flexible, and useful in different scenarios, but knowing when to use which can save you time, resources, and a few headaches down the road.

In this post, we’ll break down the core differences between VMs and LXCs, and help you decide when to use each.

What Are VMs?

A Virtual Machine is a full emulation of a physical computer. It includes a complete operating system (OS), virtual hardware (CPU, RAM, storage, network interfaces), and runs independently from the host system.

Key features of VMs:

  • Full OS isolation
  • Supports any OS (Linux, Windows, BSD, etc.)
  • Ideal for running legacy or proprietary software
  • Strong security boundaries

What Are LXCs?

Linux Containers (LXCs) are a form of lightweight virtualisation. Instead of emulating hardware, they share the host system's kernel but isolate processes and filesystems. Think of them as chroot environments on steroids.

Key features of LXCs:

  • Much lower overhead than VMs
  • Extremely fast startup and shutdown
  • Shares the host's Linux kernel (only supports Linux guests)
  • Easier resource management

Key Differences

Feature VMs LXCs
OS Support Any OS (Linux, Windows, BSD) Linux only
Performance Slower boot, higher resource use Near-native speed
Overhead High (full kernel + hardware) Low (shared kernel)
Portability Highly portable, easy snapshots Lightweight, but less portable
Security Strong isolation Good, but kernel shared
Use Cases Legacy apps, Windows Microservices, internal tools

When to Use VMs

  • You need Windows or non-Linux OS support.
  • You're running legacy apps that expect full hardware environments.
  • You require strong security isolation, e.g., multi-tenant setups.
  • You want to test different kernels or OS versions.

When to Use LXCs

  • You’re running Linux-only workloads.
  • You need maximum performance and resource efficiency.
  • You’re deploying many lightweight services.
  • You want faster startup times and easier management.

Docker?

There's been a divide for some time now about how best to run Docker on Proxmox. My personal preference is if it's just a couple of containers, then an LXC should be fine. However, if you're wanting to run more than a couple of Docker containers, then a VM might be a better option. You could of course split the multiple Docker containers into one Docker container per LXC if you wanted.

What I use LXCs for

I want to give some examples of what I run in LXCs just to give you an idea of the sort of workloads that are absolutely fine.

  • NAS (LXC running Samba, NFS, Rsync, etc.) - This might surprise you, but I've run this for years with zero issues.
  • Plex - This can take advantage of your CPU's hardware transcoding capabilities.
  • Postfix - It's just a single service, so it has no issue running in this environment.
  • Prometheus - Now, I wouldn't personally run a whole Grafana instance, but for just collecting metrics, an LXC will do nicely. Plus, if you add more servers that need metrics gathering and run out of space, an LXC disk is far easier to expand.

💬 Got a scenario you're unsure about? Drop it in the comments and I'll be happy to help you decide!