Convert Figma logo to code with AI

canonical logolxd

Powerful system container and virtual machine manager

4,316
928
4,316
274

Top Related Projects

23,475

Podman: A tool for managing OCI containers and pods.

68,613

The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems

109,710

Production-Grade Container Scheduling and Management

23,337

Complete container management platform

An open and reliable container runtime

11,728

CLI tool for spawning and running containers according to the OCI specification

Quick Overview

LXD is a next-generation system container and virtual machine manager. It offers a user experience similar to virtual machines but using Linux containers instead. LXD is image-based and provides images for a wide number of Linux distributions, allowing for easy deployment and management of containers and virtual machines.

Pros

  • Lightweight and fast compared to traditional virtual machines
  • Supports both system containers and virtual machines
  • Provides a REST API for easy integration and management
  • Offers advanced features like live migration, snapshots, and clustering

Cons

  • Limited to Linux-based guest systems (for containers)
  • Can be complex to set up and configure for advanced use cases
  • May require more system resources compared to application containers like Docker
  • Learning curve for users new to container technologies

Getting Started

To get started with LXD, follow these steps:

  1. Install LXD on your system:

    sudo snap install lxd
    
  2. Initialize LXD:

    lxd init
    
  3. Launch your first container:

    lxc launch ubuntu:20.04 mycontainer
    
  4. Enter the container:

    lxc exec mycontainer -- bash
    
  5. Stop and delete the container when done:

    lxc stop mycontainer
    lxc delete mycontainer
    

For more advanced usage and configuration options, refer to the official LXD documentation.

Competitor Comparisons

23,475

Podman: A tool for managing OCI containers and pods.

Pros of Podman

  • Daemonless architecture, improving security and reducing resource overhead
  • OCI-compliant, offering better compatibility with Docker containers
  • Rootless containers by default, enhancing security and user isolation

Cons of Podman

  • Less mature ecosystem compared to LXD
  • Limited support for Windows hosts
  • Steeper learning curve for users transitioning from Docker

Code Comparison

LXD:

lxc launch ubuntu:20.04 mycontainer
lxc exec mycontainer -- apt update
lxc file push myapp.py mycontainer/root/
lxc start mycontainer

Podman:

podman run -d --name mycontainer ubuntu:20.04
podman exec mycontainer apt update
podman cp myapp.py mycontainer:/root/
podman start mycontainer

Key Differences

  • LXD focuses on system containers, while Podman targets application containers
  • LXD uses a client-server model, whereas Podman is daemonless
  • Podman aims for Docker compatibility, while LXD has its own ecosystem
  • LXD offers built-in features like live migration and clustering, which Podman lacks
  • Podman integrates well with Kubernetes, while LXD is more suited for traditional VM-like workloads

Both projects have their strengths and are suited for different use cases. LXD excels in creating lightweight VM-like environments, while Podman shines in Docker-compatible application containerization scenarios.

68,613

The Moby Project - a collaborative project for the container ecosystem to assemble container-based systems

Pros of Moby

  • Wider ecosystem and community support
  • More extensive documentation and resources
  • Greater flexibility for customization and extensibility

Cons of Moby

  • Steeper learning curve for beginners
  • Higher resource consumption compared to LXD
  • More complex setup and configuration process

Code Comparison

LXD:

config:
  limits.cpu: "2"
  limits.memory: 2GB
devices:
  eth0:
    name: eth0
    nictype: bridged
    parent: lxdbr0
    type: nic

Moby:

version: '3'
services:
  app:
    image: myapp:latest
    deploy:
      resources:
        limits:
          cpus: '2'
          memory: 2G
    networks:
      - mynetwork
networks:
  mynetwork:
    driver: bridge

Both examples show configuration for resource limits and networking, but Moby's syntax is more verbose and uses Docker Compose format, while LXD's configuration is more concise and specific to container management.

109,710

Production-Grade Container Scheduling and Management

Pros of Kubernetes

  • More extensive ecosystem and wider community support
  • Better suited for large-scale, distributed applications
  • Advanced features for orchestration and scaling

Cons of Kubernetes

  • Steeper learning curve and more complex setup
  • Higher resource overhead for smaller deployments
  • Requires more management and maintenance

Code Comparison

LXD (container creation):

lxc launch ubuntu:20.04 mycontainer

Kubernetes (pod creation):

apiVersion: v1
kind: Pod
metadata:
  name: mypod
spec:
  containers:
  - name: mycontainer
    image: ubuntu:20.04

Summary

LXD focuses on system containers, providing a lightweight and user-friendly solution for running full operating systems in isolated environments. It's ideal for simpler deployments and development environments.

Kubernetes, on the other hand, is a comprehensive container orchestration platform designed for managing complex, distributed applications at scale. It offers more advanced features but comes with increased complexity and resource requirements.

Choose LXD for simpler, lightweight container management, and Kubernetes for large-scale, distributed applications requiring advanced orchestration capabilities.

23,337

Complete container management platform

Pros of Rancher

  • Provides a comprehensive container management platform with a user-friendly web UI
  • Supports multiple Kubernetes distributions and cloud providers
  • Offers advanced features like multi-cluster management and centralized access control

Cons of Rancher

  • More complex setup and maintenance compared to LXD
  • Higher resource requirements for running the management platform
  • Steeper learning curve for users new to container orchestration

Code Comparison

LXD (system container management):

lxc launch ubuntu:20.04 mycontainer
lxc exec mycontainer -- apt update
lxc stop mycontainer

Rancher (Kubernetes cluster management):

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

LXD focuses on system containers, providing a lightweight and easy-to-use solution for running full operating systems in containers. Rancher, on the other hand, is designed for managing Kubernetes clusters and offers a more comprehensive set of features for container orchestration and management across multiple environments.

An open and reliable container runtime

Pros of containerd

  • More widely adopted in the container ecosystem, especially in Kubernetes environments
  • Designed for broader use cases beyond just system containers
  • Offers a more extensive plugin system for customization

Cons of containerd

  • Steeper learning curve for beginners
  • Less integrated system management features compared to LXD
  • Requires additional tools for full container lifecycle management

Code Comparison

LXD:

config:
  images.auto_update_interval: 15
  core.https_address: '[::]:8443'
  core.trust_password: mysecret

containerd:

[plugins."io.containerd.grpc.v1.cri"]
  sandbox_image = "k8s.gcr.io/pause:3.2"
[plugins."io.containerd.grpc.v1.cri".containerd]
  snapshotter = "overlayfs"

LXD focuses on system-level configuration, while containerd's configuration is more granular and plugin-oriented. LXD uses YAML for its config, whereas containerd uses TOML. The LXD example shows global settings, while the containerd example demonstrates CRI plugin configuration.

Both projects serve different primary use cases: LXD for system containers and virtual machines, and containerd for application containers. The choice between them depends on specific requirements and the broader ecosystem in which they'll be used.

11,728

CLI tool for spawning and running containers according to the OCI specification

Pros of runc

  • Lightweight and focused on container runtime functionality
  • Widely adopted and supported by the container ecosystem
  • Compliant with OCI (Open Container Initiative) specifications

Cons of runc

  • Limited to container runtime operations, lacking higher-level management features
  • Requires additional tools for full container orchestration and management

Code Comparison

runc:

func (r *Runc) Create(context context.Context, id, bundle string, opts *CreateOpts) error {
    args := []string{"create", "--bundle", bundle}
    if opts != nil {
        args = append(args, opts.AdditionalArgs...)
    }
    cmd := r.command(context, append(args, id)...)
    return runOrError(cmd)
}

LXD:

func (c *containerLXC) Create(args ContainerArgs) error {
    if err := c.initConfig(args); err != nil {
        return err
    }
    if err := c.createContainer(); err != nil {
        return err
    }
    return nil
}

Key Differences

  • runc focuses on low-level container runtime operations, while LXD provides a more comprehensive container management system
  • LXD offers additional features like image management, networking, and storage management
  • runc is more commonly used as a building block for container platforms, while LXD is often used as a standalone container solution

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

LXD

LXD is a modern, secure and powerful system container and virtual machine manager.

It provides a unified experience for running and managing full Linux systems inside containers or virtual machines. LXD supports images for a large number of Linux distributions (official Ubuntu images and images provided by the community) and is built around a very powerful, yet pretty simple, REST API. LXD scales from one instance on a single machine to a cluster in a full data center rack, making it suitable for running workloads both for development and in production.

LXD allows you to easily set up a system that feels like a small private cloud. You can run any type of workload in an efficient way while keeping your resources optimized.

You should consider using LXD if you want to containerize different environments or run virtual machines, or in general run and manage your infrastructure in a cost-effective way.

Get started

See Getting started in the LXD documentation for installation instructions and first steps.

Status

TypeServiceStatus
TestsGitHubBuild Status
Go documentationGodocGoDoc
Static analysisGoReportGo Report Card
TranslationsWeblateTranslation status

Installing LXD from packages

The LXD daemon only works on Linux but the client tool (lxc) is available on most platforms.

OSFormatCommand
LinuxSnapsnap install lxd
WindowsChocolateychoco install lxc
macOSHomebrewbrew install lxc

The LXD snap packaging repository is available here.

For more instructions on installing LXD for a wide variety of Linux distributions and operating systems, and to install LXD from source, see How to install LXD in the documentation.

Client SDK packages

The LXD project provides SDK client packages for interacting with LXD servers from your own software.

These SDKs are licensed as Apache-2.0.

LanguageURL
Gohttps://pkg.go.dev/github.com/canonical/lxd/client
Pythonhttps://github.com/canonical/pylxd

For more information on using the LXD API, see REST API in the documentation.

Tools for managing LXD

If you are looking for tools (beyond lxc CLI) to manage LXD at scale (from single server to wide clusters), the following projects can be useful:

ToolLink
Ansible - connection pluginhttps://galaxy.ansible.com/ui/repo/published/community/general/content/connection/lxd/
Ansible - inventory pluginhttps://galaxy.ansible.com/ui/repo/published/community/general/content/inventory/lxd/
Bolt - LXD transporthttps://www.puppet.com/docs/bolt/latest/bolt_transports_reference.html#lxd
MicroCloudhttps://canonical.com/microcloud
Packer - LXD builderhttps://developer.hashicorp.com/packer/integrations/hashicorp/lxd/latest/components/builder/lxd
Terraform providerhttps://registry.terraform.io/providers/terraform-lxd/lxd

Security

Consider the following aspects to ensure that your LXD installation is secure:

  • Keep your operating system up-to-date and install all available security patches.
  • Use only supported LXD versions (LTS releases or monthly feature releases).
  • Restrict access to the LXD daemon and the remote API.
  • Configure your network interfaces to be secure.
  • Do not use privileged containers unless required. If you use privileged containers, put appropriate security measures in place. See Container security for more information.

See Security for detailed information.

IMPORTANT:

Local access to LXD through the Unix socket always grants full access to LXD. This includes the ability to attach file system paths or devices to any instance as well as tweak the security features on any instance.

Therefore, you should only give such access to users who you'd trust with root access to your system.

Support and community

The following channels are available for you to interact with the LXD community.

Bug reports

You can file bug reports and feature requests at: https://github.com/canonical/lxd/issues/new

Forum

A discussion forum is available at: https://discourse.ubuntu.com/c/lxd/

IRC

If you prefer live discussions, you can find us in #lxd on irc.libera.chat. See Getting started with IRC if needed.

Commercial support

Commercial support for LXD is available through Ubuntu Pro (Ubuntu Pro (Infra-only) or full Ubuntu Pro). The support covers all LTS versions for five years starting from the day of the release.

See the full service description for detailed information about what support Ubuntu Pro provides.

Documentation

The official documentation is available at: https://documentation.ubuntu.com/lxd/en/latest/

You can find additional resources on the website, on YouTube and in the Tutorials section in the forum.

Contributing

Fixes and new features are greatly appreciated. Make sure to read our contributing guidelines first!