Distrobox

Jump to: navigation, search

Distrobox is a tool for providing containerised runtimes of several different Linux distributions.

It is particularly interesting for users of immutable Linux (eg. MicroOS) where it can provide a read-write userspace so new tools can be installed without needing a reboot. It's similar to other tools such as 'toolbox' (which is included on the server version of MicroOS by default), but has some other advantages for desktop usage. Please refer to https://github.com/89luca89/distrobox for all options.

Quick Start

Aeon

Distrobox is already installed on Aeon machines

Create and open a default tumbleweed environment with:

  $ distrobox enter

Leap, Tumbleweed, and MicroOS

Leap does not come with preinstalled Distrobox therefore users have to install it manually. In case of Docker your user should be in the group docker, otherwise, you'll receive following error permission denied while trying to connect to the Docker daemon socket.

 $ sudo zypper install distrobox # pulls in docker by default
 $ sudo groupadd docker; sudo usermod -aG docker $USER # you should re-login with the user for changes to take effect
 $ sudo systemctl enable --now docker
 $ distrobox enter

Distrobox For Packagers

openSUSE has a customised distrobox-ready container image for use by openSUSE Packagers, Release Managers and such. In addition to being really useful for MicroOS Desktop users, it may also be of interest to users of Leap or other non-openSUSE Distributions.

This distrobox already has all the following tools installed and ready for use

  • osc
  • git
  • build
  • vim
  • many osc service plugins (eg tar, tar_scm, obs_scm, recompress, go_modules, etc)
  • osc staging, cycle and origin plugins
  • opensuse-release-tools

To create a distrobox using this image run:

  $ distrobox create --root --name tumbleweed-pkg --image registry.opensuse.org/opensuse/distrobox-packaging:latest

NOTES:

  • --root is optional, but needed if you want to use features like `osc build`
  • --name can be whatever you want your distrobox name to be, just be sure to substitute whatever you use instead below also
  • --hostname is optional, but recommended when running a rootless distrobox to avoid issues with packages like netcfg

Please make sure to use distrobox enter --root in case you've used --root during creation, otherwise you would create a brand new distrobox.

To enter the distrobox run

  $ distrobox enter tumbleweed-pkg

Using bpftrace inside Distrobox

openSUSE has a special distrobox container tailored for bpftrace's usage. This can come handy if one has profiling and observability needs on their Aeon setup. Another potential use case is just having the same needs in the context of a Tumbleweed setup with a little big of automagical help.

The distrobox can be created using the following command:

   $ distrobox create --root --name tumbleweed-bpftrace --image registry.opensuse.org/opensuse/distrobox-bpftrace:latest

And it can be entered right after by issuing this command:

   $ distrobox enter --root tumbleweed-bpftrace

In this case the --root option is mandatory because the container has to be given extensive capabilities in order to observe the current state of the system.

Distrobox export

With distrobox-export you can create a shortcut in your host system to open an application from a distrobox container. For example, to export a desktop (GUI) app you installed, enter the distrobox of your choice and enter the following (as a regular user, not as root):

  $ distrobox-export --app <name of the app>

This will populate your user's directory with the corresponding <name of the app>.desktop file, the icon, and a link placed in ~/.local/share/applications/ to populate the user's menu as if the application had been installed on the host.

Alternatively, you can export a non-desktop program (that does not have a .desktop file) with the --bin option. From within the distrobox container, as a regular non-root user, run:

   $ distrobox-export --bin /path/to/bin/your_application

This will install a wrapper script in ~/.local/bin/your_application on the host.

To learn more about additional flags and how to export other apps that require services (e.g. syncthing), see the distrobox-export man page.

Getting distrobox images for various openSUSE distributions

You can also pre-intall additional packages by --init --additional-packages "systemd"

  $ distrobox create -i registry.opensuse.org/opensuse/leap:latest -n leap15
  $ distrobox create -i registry.opensuse.org/opensuse/tumbleweed:latest -n tumbleweed