Incus
Table of Contents
Open-source container and VM manager — a community fork of LXD, maintained by Linux Containers. Provides a unified interface for managing system containers (LXC) and full virtual machines (QEMU) with a consistent CLI and REST API. Lighter weight than Proxmox for single-node setups; suitable for a home lab or development environment where you want containers and VMs without a full hypervisor stack.
Related: Linux Containers Containerization Proxmox Container Escape Docker
Installation
# Install via snap (recommended — latest version) snap install incus # Or native package (Debian/Ubuntu) apt install incus # Initialise (interactive setup — storage pool, network bridge) incus admin init # Minimal non-interactive init for a lab incus admin init --minimal
Instances
Containers
# Launch a container from an image incus launch images:ubuntu/22.04 mycontainer incus launch images:debian/12 debian-test # List running instances incus list # Shell into container incus exec mycontainer -- bash incus exec mycontainer -- /bin/sh # Run a single command incus exec mycontainer -- apt update # Stop / start / restart incus stop mycontainer incus start mycontainer incus restart mycontainer # Delete incus delete mycontainer incus delete mycontainer --force # force delete while running
Virtual Machines
# Launch a VM (requires --vm flag) incus launch images:ubuntu/22.04 myvm --vm # Connect to VM console incus console myvm # Connect via VGA console (if GUI needed) incus console myvm --type=vga
Images
# List available remote images (common remotes: ubuntu, images) incus image list ubuntu: incus image list images: | grep debian # List locally cached images incus image list # Pull an image without launching incus image copy images:ubuntu/22.04 local: incus image copy images:ubuntu/22.04 local: --alias ubuntu-22 # Remove local image incus image delete ubuntu-22
Configuration
# Show instance config incus config show mycontainer # Set resource limits incus config set mycontainer limits.cpu 2 incus config set mycontainer limits.memory 2GB # Set environment variable incus config set mycontainer environment.MY_VAR "value" # Mount a host directory into a container incus config device add mycontainer hostdir disk \ source=/home/user/shared \ path=/mnt/shared # Expose a port (NAT from host to container) incus config device add mycontainer myport proxy \ listen=tcp:0.0.0.0:8080 \ connect=tcp:127.0.0.1:80
Snapshots
# Create snapshot incus snapshot create mycontainer snap01 # List snapshots incus snapshot list mycontainer # Restore snapshot incus snapshot restore mycontainer snap01 # Delete snapshot incus snapshot delete mycontainer snap01
File Transfer
# Copy file into container incus file push localfile.txt mycontainer/tmp/localfile.txt # Copy file out of container incus file pull mycontainer/etc/passwd /tmp/passwd # Edit a file directly inside a container incus file edit mycontainer/etc/hosts
Profiles
Profiles let you define reusable configuration — apply a profile to multiple instances to share settings.
# List profiles incus profile list # Show default profile incus profile show default # Create a profile incus profile create labprofile # Edit a profile incus profile edit labprofile # Apply a profile to an instance incus launch images:ubuntu/22.04 mycontainer --profile default --profile labprofile
Networking
# List networks incus network list # Show bridge details incus network show incusbr0 # Create a new isolated network (no external access) incus network create labnet --type=bridge incus network set labnet ipv4.nat false # Attach container to a specific network incus config device add mycontainer eth1 nic \ network=labnet \ name=eth1
Security Relevance
Incus containers share the host kernel — a container escape vulnerability allows an attacker who compromises a container to reach the host. See Container Escape for techniques.
# Check if running in a container (from inside) cat /proc/1/environ | grep -i container systemd-detect-virt # Privileged containers are higher risk # Check: incus config show <container> | grep security.privileged
Tips
- Incus is the maintained fork of LXD — prefer it over LXD for new deployments; LXD is now a Canonical commercial product
- System containers (LXC) are not Docker containers — they run a full init system and behave like a lightweight VM rather than a single-process container
- For the home lab, Incus is a good lightweight alternative to Proxmox when you want containers and simple VMs without the full hypervisor overhead
- The isolated network approach (
ipv4.nat false) is the cleanest way to run vulnerable lab targets without internet access - Snapshots before destructive testing and restore after is the standard lab workflow — much faster than rebuilding from image