System container image builder for LXC and Incus https://linuxcontainers.org
Find a file
Thomas Hipp aa997ec4e1
Merge pull request #955 from stgraber/main
gomod: Update dependencies
2025-12-05 20:47:40 +01:00
.github/workflows github: Ignore unrelated GHSA 2025-11-15 18:27:49 -05:00
.sphinx doc: Add XP (for Windows XP) to wordlist 2025-02-18 12:28:26 -05:00
distrobuilder systemd-generator: Fix console-getty handling 2025-10-13 01:58:40 -04:00
doc windows: Add 2k25 to supported list 2025-07-07 13:38:44 -07:00
generators Fix golang-ci reported issues 2025-04-02 14:37:13 -04:00
image incus: Support compression=none for VMs 2025-06-17 16:13:15 -04:00
managers managers: Fix typo 2025-04-13 17:30:08 -04:00
shared distrobuilder: Make linter happy 2025-09-26 18:33:05 -07:00
sources sources: Update the tests for HTTP client 2025-11-29 23:14:46 -05: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 windows: Fix lib dir location 2025-10-07 18:20:51 -07: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 gomod: Update dependencies 2025-12-05 13:51:23 -05:00
go.sum gomod: Update dependencies 2025-12-05 13:51:23 -05:00
Makefile Makefile: Bump minimum to Go 1.24.7 2025-11-15 18:18:11 -05: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.