Home

Incus Reference Guide

Modern container and virtual machine manager

Containers vs Virtual Machines

Incus uniquely supports both system containers and full virtual machines through a unified interface. Understanding the differences helps you choose the right instance type for your workload.

Quick Comparison

Feature Containers Virtual Machines
Technology LXC (Linux Containers) QEMU/KVM
Kernel Shared with host Independent guest kernel
Boot Time 1-2 seconds 10-30 seconds
Memory Overhead ~1-5 MB ~100-200 MB minimum
Density Very high (100s per host) Moderate (10s per host)
Isolation Process-level isolation Hardware-level isolation
Performance Near-native (~99%) Near-native (~95-98%)
OS Support Linux only Any OS (Windows, BSD, etc.)
Security Namespace isolation Hardware isolation
Use Case Microservices, dev/test Legacy apps, non-Linux

Visual Comparison

Architecture Differences

System Containers App A Dependencies App B Dependencies App C Dependencies LXC Runtime (Namespaces + Cgroups) Host Operating System (Linux Kernel) Hardware (CPU, RAM, Disk) Container Benefits ✓ Minimal overhead ✓ Fast startup (seconds) ✓ High density Virtual Machines Application Guest OS Guest Kernel VM 1 Application Guest OS Guest Kernel VM 2 QEMU/KVM Hypervisor Host OS (Linux Kernel) Hardware (CPU, RAM, Disk) VM Benefits ✓ Complete isolation ✓ Any OS supported

Containers: Deep Dive

How Containers Work

System containers in Incus use Linux kernel features to create isolated execution environments that share the host kernel. They provide a full Linux system environment while being extremely lightweight.

Container Isolation Technologies

  • Namespaces: Process, network, mount, IPC, UTS, user isolation
  • Cgroups: Resource limits and accounting (CPU, memory, I/O, network)
  • AppArmor/SELinux: Mandatory access control profiles
  • Seccomp: System call filtering for security
  • Capabilities: Fine-grained privilege control

Container Use Cases

Container Limitations

Virtual Machines: Deep Dive

How VMs Work

Incus VMs use QEMU with KVM acceleration to provide full hardware virtualization. Each VM has its own kernel, complete OS installation, and emulated or paravirtualized hardware.

VM Virtualization Technologies

  • KVM: Kernel-based Virtual Machine for hardware acceleration
  • QEMU: Machine emulator and virtualizer
  • virtio: Paravirtualized I/O drivers for performance
  • UEFI/BIOS: Firmware support for modern and legacy systems
  • VirtIO-FS: High-performance filesystem sharing
  • VFIO: Device passthrough for GPU, USB, PCIe devices

VM Use Cases

VM Limitations

Performance Comparison

Metric Containers VMs Notes
CPU Performance 99-100% native 95-98% native KVM provides near-native performance
Memory Performance 100% native 98-99% native Minimal overhead with KVM
Disk I/O 95-100% native 85-95% native VirtIO reduces gap significantly
Network I/O 95-100% native 90-95% native VirtIO-net provides good performance
Boot Time 1-3 seconds 10-30 seconds Containers skip full OS boot
Memory Overhead 1-5 MB 100-200 MB+ VMs need full OS in memory

Choosing Between Containers and VMs

Decision Framework

Choose Containers when:

  • Running Linux workloads exclusively
  • Need maximum density and resource efficiency
  • Require fast startup and shutdown times
  • Working with microservices or cloud-native applications
  • Need disposable, ephemeral environments
  • Security isolation at process level is sufficient

Choose VMs when:

  • Running non-Linux operating systems (Windows, BSD, etc.)
  • Need hardware-level isolation for security
  • Require a specific kernel version or custom kernel
  • Working with legacy applications expecting full OS
  • Need GPU passthrough or device passthrough
  • Compliance requires complete isolation
  • Testing kernel modules or system-level software

Incus Unified Management

One of Incus's key strengths is providing a unified interface for both containers and VMs. The same commands, APIs, and workflows apply to both instance types.

Creating Instances

# Create a container (default)
incus launch ubuntu:22.04 my-container

# Create a VM (add --vm flag)
incus launch ubuntu:22.04 my-vm --vm

# Both use the same image format
# Both managed with identical commands
incus list
incus exec my-container -- bash
incus exec my-vm -- bash

Hybrid Deployments

You can run containers and VMs side-by-side on the same Incus host, choosing the best tool for each workload:

Resource Efficiency Example

Typical Server Capacity

Server: 32 CPU cores, 128 GB RAM, 2 TB SSD

Container Deployment:

  • 100+ lightweight containers (web apps, microservices)
  • Average: 512 MB RAM, 0.5 CPU per container
  • Fast deployment, instant scaling
  • Remaining resources for bursting

VM Deployment:

  • 20-30 VMs (full OS instances)
  • Average: 4 GB RAM, 2 CPU per VM
  • Complete isolation, multiple OS types
  • Better for production databases, Windows apps

Hybrid Deployment (Recommended):

  • 50 containers for stateless applications
  • 10 VMs for databases, Windows services, special requirements
  • Best of both worlds: efficiency + flexibility

Migration Capabilities

Feature Containers VMs
Live Migration Yes (CRIU) Yes (KVM)
Stateful Snapshots Yes (with CRIU) Yes (memory + disk)
Cold Migration Fast (rsync) Slower (full disk)
Downtime Milliseconds Seconds

Understanding the trade-offs between containers and VMs allows you to design efficient, secure, and performant infrastructure with Incus. The unified management interface means you can use both technologies seamlessly.