Distrobox: Difference between revisions

From NixOS Wiki
Onny (talk | contribs)
Use with different architecture
Onny (talk | contribs)
Line 32: Line 32:
Following example will run an Ubuntu container with a different architecture than the host, in this case arm64.<syntaxhighlight lang="nix">
Following example will run an Ubuntu container with a different architecture than the host, in this case arm64.<syntaxhighlight lang="nix">
sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
distrobox create -n ubuntu --image arm64v8/ubuntu
distrobox create -n debian --image arm64v8/debian
distrobox enter ubuntu
distrobox enter debian
</syntaxhighlight>
</syntaxhighlight>
[[Category:Applications]]
[[Category:Applications]]
[[Category:Container]]
[[Category:Container]]

Revision as of 16:03, 5 August 2024

Distrobox offers you to use any linux distribution inside your terminal as a simple wrapper for Podman, Docker or Lilipod.

Setup

Distrobox uses Docker internally to fetch and run system images. Easily get started by enabling Podman with Docker-compatibility mode.

virtualisation.podman = {
  enable = true;
  dockerCompat = true;
};

environment.systemPackages = [ pkgs.distrobox ];

Usage

Setup container with latest Arch Linux image

# distrobox create --name archlinux --init --image archlinux:latest

Enter Arch Linux container

# distrobox enter archlinux

For further usage, please refer to the Distrobox documentation.

Tips and tricks

Using different architecture

Following example will run an Ubuntu container with a different architecture than the host, in this case arm64.

sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes
distrobox create -n debian --image arm64v8/debian
distrobox enter debian