distrobox-assemble - Man Page

distrobox assemble distrobox-assemble

Description

distrobox-assemble takes care of creating or destroying containers in batches, based on a manifest file. The manifest file by default is ./distrobox.ini, but can be specified using the --file flag.

Synopsis

distrobox assemble

--file:         path or URL to the distrobox manifest/ini file
--name/-n:      run against a single entry in the manifest/ini file
--replace/-R:       replace already existing distroboxes with matching names
--dry-run/-d:       only print the container manager command generated
--verbose/-v:       show more verbosity
--version/-V:       show version

Examples

This is an example manifest file to create two containers:

[ubuntu]
additional_packages="git vim tmux nodejs"
image=ubuntu:latest
init=false
nvidia=false
pull=true
root=false
replace=true
start_now=false

# You can add comments using this #
[arch] # also inline comments are supported
additional_packages="git vim tmux nodejs"
home=/tmp/home
image=archlinux:latest
init=false
start_now=true
init_hooks="touch /init-normal"
nvidia=true
pre_init_hooks="touch /pre-init"
pull=true
root=false
replace=false
volume="/tmp/test:/run/a /tmp/test:/run/b"

Create

We can bring them up simply using

distrobox assemble create

If the file is called distrobox.ini and is in the same directory you’re launching the command, no further arguments are needed. You can specify a custom path for the file using

distrobox assemble create --file /my/custom/path.ini

Or even specify a remote file, by using an URL:

distrobox-assemble create --file https://raw.githubusercontent.com/89luca89/dotfiles/master/distrobox.ini

Replace

By default, distrobox assemble will replace a container only if replace=true is specified in the manifest file.

In the example of the manifest above, the ubuntu container will always be replaced when running distrobox assemble create, while the arch container will not.

To force a replace for all containers in a manifest use the --replace flag

distrobox assemble create --replace [--file my/custom/path.ini]

Remove

We can bring down all the containers in a manifest file by simply doing

distrobox assemble rm

Or using a custom path for the ini file

distrobox assemble rm --file my/custom/path.ini

Test

You can always test what distrobox would do by using the --dry-run flag. This command will only print what commands distrobox would do without actually running them.

Available options

This is a list of available options with the corresponding type:

Types legend:

Flag NameType
additional_flagsstring_listAdditional flags to pass to the container manager
additional_packagesstring_listAdditional packages to install inside the container
homestringWhich home directory should the container use
imagestringWhich image should the container use, look here for a list
init_hooksstring_listCommands to run inside the container, after the packages setup
pre_init_hooksstring_listCommands to run inside the container, before the packages setup
volumestring_listAdditional volumes to mount inside the containers
exported_appsstring_listApp names or desktopfile paths to export
exported_binsstring_listBinaries to export
exported_bins_pathstringOptional path where to export binaries (default: $HOME/.local/bin)
entryboolGenerate an entry for the container in the app list (default: false)
start_nowboolStart the container immediately (default: false)
initboolSpecify if this is an initful container (default: false)
nvidiaboolSpecify if you want to enable NVidia drivers integration (default: false)
pullboolSpecify if you want to pull the image every time (default: false)
rootboolSpecify if the container is rootful (default: false)
unshare_ipcboolSpecify if the container should unshare the ipc namespace (default: false)
unshare_netnsboolSpecify if the container should unshare the network namespace (default: false)
unshare_processboolSpecify if the container should unshare the process (pid) namespace (default: false)
unshare_devsysboolSpecify if the container should unshare /dev (default: false)
unshare_allboolSpecify if the container should unshare all the previous options (default: false)

For further explanation of each of the option in the list, take a look at the distrobox create usage, each option corresponds to one of the create flags.

Advanced example

[tumbleweed_distrobox]
image=registry.opensuse.org/opensuse/distrobox
pull=true
additional_packages="acpi bash-completion findutils iproute iputils sensors inotify-tools unzip"
additional_packages="net-tools nmap openssl procps psmisc rsync man tig tmux tree vim htop xclip yt-dlp"
additional_packages="git git-credential-libsecret"
additional_packages="patterns-devel-base-devel_basis"
additional_packages="ShellCheck ansible-lint clang clang-tools codespell ctags desktop-file-utils gcc golang jq python3"
additional_packages="python3-bashate python3-flake8 python3-mypy python3-pipx python3-pycodestyle python3-pyflakes python3-pylint python3-python-lsp-server python3-rstcheck python3-yapf python3-yamllint rustup shfmt"
additional_packages="kubernetes-client helm"
init_hooks=GOPATH="${HOME}/.local/share/system-go" GOBIN=/usr/local/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest;
init_hooks=GOPATH="${HOME}/.local/share/system-go" GOBIN=/usr/local/bin go install github.com/onsi/ginkgo/v2/ginkgo@latest;
init_hooks=GOPATH="${HOME}/.local/share/system-go" GOBIN=/usr/local/bin go install golang.org/x/tools/cmd/goimports@latest;
init_hooks=GOPATH="${HOME}/.local/share/system-go" GOBIN=/usr/local/bin go install golang.org/x/tools/gopls@latest;
init_hooks=GOPATH="${HOME}/.local/share/system-go" GOBIN=/usr/local/bin go install sigs.k8s.io/kind@latest;
init_hooks=ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/conmon;
init_hooks=ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/crun;
init_hooks=ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/docker;
init_hooks=ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/docker-compose;
init_hooks=ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/flatpak;
init_hooks=ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/podman;
init_hooks=ln -sf /usr/bin/distrobox-host-exec /usr/local/bin/xdg-open;
exported_apps="htop"
exported_bins="/usr/bin/htop /usr/bin/git"
exported_bins_path="~/.local/bin"

Info

Oct 2024 Distrobox User Manual