Run Any Linux App on Any Distro with Distrobox

Jarret B

Well-Known Member
Staff member
May 22, 2017
Reaction score
Sometimes, there may be an app that you want to run, but it is available only on a certain distro. What can you do? Download the source code and try to compile it for your distro?

Now you can do this with Distrobox.

Distrobox is a wrapper for Docker that allows a container to access all the hardware on your physical machine and run apps, even graphical ones, inside your local system.


The first thing you need is to install Docker. If you have installed Docker, then you are halfway there. Otherwise, see 'Docker Basics and Install' to get Docker installed.

After installing Docker, the second step is to install Distrobox. The command is:

wget -qO- | sudo sh

You should see something similar to Figure 1.

Figure 1.JPG


Now that what we need is on our system, we can continue.


Before we get deeply into this, let’s look at a quick example. Now, we know that the Docker images are minimal sized images. So, we can download a Docker image and not have to worry about size too much.

On my Host system, it is Ubuntu 22.04.3 LTS, it has a hostname of ‘Optiplex’. The hostname is important here, so keep it in mind.

To get system information, I ran:

sudo apt update
sudo apt install neofetch

The command can give me the information I need on the host system, as shown in Figure 2.

Figure 2.jpg


If I want to find a specific Linux distro, such as Kali, I can perform a search with Docker:

docker search kali

The result I will use is ‘kalilinux/kali-rolling’. The image is a weekly build of the latest updates.

We do not need to pull the image with Docker, we can use Distrobox to get it. Now, keep in mind that the image name will be the host's name by default, but we’ll change it.

NOTE: If I already pulled the image with Docker, we can still attach to it with the same command. Be sure to use the same image name.

To create a Distrobox attachment to the image, we will attach to the ‘kali-rolling’ image and call it ‘kali’ for short. Use the command:

distrobox create -i kalilinux/kalirolling -n kali

The ‘-i’ parameter is the name of the image. Use the complete name found in the listing ‘docker images’. To give a name to the attachment, use the ‘-n’ parameter with a new name. So, now I can refer to the Kali image as ‘kali’.

NOTE: If you perform a ‘distrobox create’ and the image does not exist, it will prompt you to pull the image.

If I want to use the image and open a command-line interface (CLI) in Kali, I use:

distrobox enter kali

I can use the parameter ‘--root’ to enter the CLI with root privileges, but this is not good practice. You can always use the ‘sudo’ command inside the image to get elevated privileges.

When you ‘enter’ an image, it will start the container and then build the packages. After you complete these steps, it should ask you to enter and confirm a password for your username ($USER), as shown in Figure 3.

Figure 3.jpg


You can see that my username is ‘jarret’ and my hostname is ‘kali’.

So now, I can run the same commands as before and install ‘neofetch’ so I can see the information on my Operating System inside the container. It shows the results in Figure 4.

Figure 4.jpg


This can show you we are inside another OS that is running in a container.

If I type ‘exit’, I can close the container and free up the memory. So, what about installing an app and running it? Let’s do something fancy.

On my Host system, I do not have Gparted installed. Now you may ask, “But Gparted is a graphical utility and how will it deal with the hardware of the Host system?”.

Well, the container is not 100% sandboxed. We get full access to the Host system’s hardware. Let me show you.

For this example, let’s try Arch Linux. The name of the image is ‘archlinux’, so we will pull it with the command:

distrobox create -i archlinux -n arch

Answer ‘Y’ to pull the image if you don’t already have it. Once it downloads, use the command ‘distrobox enter arch’ to access it. Remember that I named the connection ‘arch’, so again this will be my hostname, see Figure 5.

Figure 5.jpg


So I performed:

sudo pacman -Syu
sudo pacman -Syy neofetch

We now have Arch running on Ubuntu. I can install any app in Arch, but let’s look at a GUI and something to see our hardware. Perform the next command:

sudo pacman -SYY gparted

The program ‘gparted’ should now be on Arch, but Arch has not Graphical User Interface (GUI). Try the following command in Arch:

sudo gparted

Figure 6.jpg


In Figure 6, you can see that the ‘gparted’ app starts up, as a GUI, on my Ubuntu system. At the top of the window, it states the Hostname of the system: ‘arch’. It shows my devices, the SSD and the two USB drives attached to the system. I could add on the NTFS support and then format a USB drive as NTFS.

Distrobox App

You should hopefully see some benefits of this ability. You can run any app in its native distro in the distro of your system.

Let’s make this a little cooler.

In a host terminal, you can run ‘distrobox list’ to see all the connections you have made. If you stop the image in Distrobox, then the connection is no longer valid and will appear a gray color. Valid connections are green. You can remove a connection with the command ‘distrobox rm <connection name>’. To run the image and make it active again, you can ‘enter’ it or double-click it on your menu. When you create a distrobox image, it appears in your menu. By opening it, a terminal will open and you are in the image again.

By clicking on it though, you get the entire image, but what if you only want a single application?

Let’s make something new. I will create an image for ‘Linux Mint’:

distrobox create -i linuxmintd/mint21.2-amd64 -n mint

You should now have an image of Linux Mint. You can open it with:

distrobox enter mint

Or, instead of the last command, open your menu and find ‘mint’ there. Once opened, you can install neofetch and run it to see an output like Figure 7.

Figure 7.jpg


Let’s assume that a program such as ‘wireshark’ in Kali is not installable on our host’s system. We can install it in ‘kali’ with the command ‘sudo apt install wireshark -y’. Now, we want to run it in our host OS without having to open the image in ‘distrobox’ every time.

We can use the command ‘distrobox-export --app <app-name>’. The command should create a shortcut in our menu for ‘wireshark’.

The command to get this to run from ‘kali’ would be ‘distrobox-export --app wireshark’ from within the ‘kali’ image. The shortcut should be in the Applications Menu and you can run from the GUI without needing to open a terminal.

If you want to remove the shortcut, then you add the parameter ‘-d’ to delete it.

distrobox-export -d -a wireshark

Again, you must execute this in the image itself.


Distrobox can be a very handy tool to open all physical hardware to a Docker container.

You may also run individual apps from a distro that you do not want to convert or re-compile to your distro.

Experiment with Distrobox, it is quite interesting.

"distrobox create -i kalilinux/kalirolling -n kali
Image kalilinux/kalirolling not found.
Do you want to pull the image now? [Y/n]: y
Using default tag: latest
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "ht
tp://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=kalilinux%2Fkalirolling&tag=latest": dial unix /
var/run/docker.sock: connect: permission denied"
The image does not exist. It has been changed to 'kalilinix/kali-rolling.
You can use the command for 'docker' to get a listing of available images with 'docker search kali'.

Members online