VM or LXC

LXC (Linux Containers) provide a semi-isolated user space environment for running applications, giving them a "semi" separate environment from the host system. Unlike traditional VMs, they are not completely isolated and are not OS-agnostic.

Advantages and Disadvantages of LXC Containers

  • Quick Startup: LXC containers do not require a full boot process; they just start their environment and any installed services.
  • Potential Interference: Because they run directly on the host, they can leak or interfere with the host under extreme conditions.
  • AppArmor Integration: Some additional configuration is required for AppArmor, usually enabling a feature via the GUI.
  • Memory Constraints: Low memory on the server or within the LXC can lead to process termination.
  • Migration Limitations: Live migrations are not possible; the container must be stopped, copied, and restarted on another host.
  • Resource Sharing: Pass-through is not required as containers can share and see many of the server's resources, such as the GPU, unlike VMs which lock resources.
  • OS Dependency: LXC containers can only run on Linux or an OS that uses the server's kernel.
  • Flexible Storage: Containers can either carve out disk space or use existing storage on the server through mount point setup.
  • Shared Mount Points: Containers can share/use the same mount points without needing a third-party sharing mechanism like NFS.
  • Host Accessibility: The host has direct access to the container's filesystem.
  • Simpler Backups: Backups are straightforward as they do not involve a virtual disk, just the directory and file structure (like a large zip or tgz file).