System container image builder for LXC and Incus https://linuxcontainers.org
  • Go 93.1%
  • Shell 2.1%
  • HTML 1.6%
  • Python 1%
  • CSS 0.7%
  • Other 1.5%
Find a file
Thomas Hipp 8671396767
Merge pull request #1011 from stgraber/main
Add more support for loongarch64
2026-09-01 20:11:06 +02:00
.github/workflows github: Ignore unrelated GHSA 2025-11-15 18:27:49 -05:00
.sphinx doc: Ignore HTTP errors on docutils.sourceforge.io 2026-02-23 14:25:00 -05:00
distrobuilder incus: Add configurable VM boot partition size 2026-08-25 23:58:09 +02:00
doc incus: Add configurable VM boot partition size 2026-08-25 23:58:09 +02:00
generators Update import paths to pongo2/v6 2026-08-10 18:18:35 -06:00
image Update to depend on Incus v7 2026-05-06 00:36:26 +00:00
managers managers/pacman: Populate loong64 port keyring 2026-09-01 13:55:15 -04:00
shared incus: Add configurable VM boot partition size 2026-08-25 23:58:09 +02:00
sources sources/archlinux: Add loong64 support 2026-09-01 13:55:14 -04:00
test/lint lint: Run codespell automatically 2025-03-18 12:27:04 +00:00
testdata shared: Add file verification 2018-02-15 18:25:07 +01:00
windows Update import paths to pongo2/v6 2026-08-10 18:18:35 -06:00
.codespell-ignore lint: Run codespell automatically 2025-03-18 12:27:04 +00:00
.gitignore doc: basic Sphinx setup 2023-02-19 13:20:54 +01:00
.golangci.yml golang-ci: Upgrade to v2 2025-04-02 14:23:16 -04:00
AUTHORS initial commit 2018-02-06 15:24:32 +01:00
CODE_OF_CONDUCT.md Add CODE_OF_CONDUCT.md 2023-07-06 16:59:51 +02:00
CONTRIBUTING.md Add CONTRIBUTING.md 2019-07-22 17:19:48 +02:00
COPYING initial commit 2018-02-06 15:24:32 +01:00
go.mod Update go.mod 2026-08-10 18:18:55 -06:00
go.sum Update go.mod 2026-08-10 18:18:55 -06:00
Makefile Makefile: Pin github.com/sigstore/fulcio, current release requires go1.26 2026-08-10 18:17:51 -06:00
mkdocs.yml *: Update short description to mention VM images are supported 2023-06-21 22:20:32 -04:00
README.md doc: Document runtime deps for building VM images 2025-03-28 18:15:32 +01:00

distrobuilder

System container and VM image builder for Incus and LXC.

Status

Type Service Status
CI GitHub Build Status
Project status CII Best Practices CII Best Practices

Command line options

The following are the command line options of distrobuilder. You can use distrobuilder to create container images for both Incus and LXC.

$ distrobuilder
System container and VM image builder for Incus and LXC

Usage:
  distrobuilder [command]

Available Commands:
  build-dir      Build plain rootfs
  build-incus    Build Incus image from scratch
  build-lxc      Build LXC image from scratch
  help           Help about any command
  pack-incus     Create Incus image from existing rootfs
  pack-lxc       Create LXC image from existing rootfs
  repack-windows Repack Windows ISO with drivers included

Flags:
      --cache-dir         Cache directory
      --cleanup           Clean up cache directory (default true)
      --debug             Enable debug output
      --disable-overlay   Disable the use of filesystem overlays
  -h, --help              help for distrobuilder
  -o, --options           Override options (list of key=value)
  -t, --timeout           Timeout in seconds
      --version           Print version number

Use "distrobuilder [command] --help" for more information about a command.

Installing from package

distrobuilder is available from the Snap Store.

sudo snap install distrobuilder --classic

Installing from source

To compile distrobuilder from source, first install the Go programming language, and some other dependencies.

  • Debian-based:

    sudo apt update
    sudo apt install -y golang-go gcc debootstrap rsync gpg squashfs-tools git make build-essential libwin-hivex-perl wimtools genisoimage
    
  • ArchLinux-based:

    sudo pacman -Syu
    sudo pacman -S go gcc debootstrap rsync gnupg squashfs-tools git make hivex cdrtools wimlib --needed
    
  • Red Hat-based:

    sudo dnf check-update
    sudo dnf install golang gcc debootstrap rsync gnupg2 squashfs-tools git make hivex genisoimage
    

NOTE: Distrobuilder requires Go 1.21 or higher, if your distribution doesn't have a recent enough version available, get it from upstream.

Second, download the source code of the distrobuilder repository (this repository).

mkdir -p $HOME/go/src/github.com/lxc/
cd $HOME/go/src/github.com/lxc/
git clone https://github.com/lxc/distrobuilder

Third, enter the directory with the source code of distrobuilder and run make to compile the source code. This will generate the executable program distrobuilder, and it will be located at $HOME/go/bin/distrobuilder.

cd ./distrobuilder
make

Finally, you can run distrobuilder as follows.

$HOME/go/bin/distrobuilder

You may also add the directory $HOME/go/bin/ to your $PATH so that you do not need to run the command with the full path.

Runtime dependencies for building VM images

If you intend to build Incus VM images (via distrobuilder build-incus --vm), your system will need certain tools installed:

  • Debian-based:
    sudo apt update
    sudo apt install -y btrfs-progs dosfstools qemu-kvm
    

How to use

See How to use distrobuilder for instructions.

Troubleshooting

See Troubleshoot distrobuilder.