Distrobox is a nifty tool that allows you to create and manage containers on your favorite Linux distribution using either Docker or Podman. The launched container becomes highly integrated with the host system and this allows sharing of the user’s HOME directory along with external storage, USB devices, and graphical applications.
Distrobox is based on an OCI image and implements similar concepts to those of ToolBox which is built on top of podman and OCI standard container technologies.
In this guide, we will demonstrate how to install DistroBox to run any Linux distribution inside your Linux terminal. For this guide, we are running Fedora 34.
Prerequisites
Before you proceed, ensure you have the following:
- Minimum podman version: 2.1.0 or docker version: 18.06.1.
Step 1: Install DistroBox on Linux System
Installing DistroBox is a piece of cake. Simply run the following curl command which downloads and run the installation script.
$ curl https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo sh
In Fedora, DistroBox is available from the Copr repository. So, enable the Copr repository on Fedora.
$ sudo dnf copr enable alciregi/distrobox
Once the Copr repository has been added, use the DNF package manager to install Distrobox.
$ sudo dnf install distrobox
Step 2: Create a Container from an Image
With Distrobox installed, we can now get started with creating and running containers. To pull an image and run a container from the image, use the distrobox-create command as follows.
$ distrobox-create --name container-name --image os-image:version
In this example, we are creating a container called debian10-distrobox from the Debian 10 image.
$ distrobox-create --name debian10-distrobox --image debian:10
The command pulls the Debian 10 image from Docker Hub and creates a container called debian10-distrobox.
To get a complete list of operating systems and versions supported by Distrobox containers, visit the Distrobox Project page.
To list containers created with Distrobox, run:
$ distrobox-list
Step 3: Accessing a Distrobox Container
To access the shell of the newly created Linux container, use the distrobox-enter command as follows:
$ distrobox-enter --name container-name
For example, to access our container, we will run the command:
$ distrobox-enter --name debian10-distrobox
From here, you can run commands inside the container. For example, the following command checks the OS version.
$ cat /etc/os-release
You can also install applications. Here, we are installing the Neofetch utility tool.
$ sudo apt install neofetch
Once Neofetch is installed, launch it as follows.
Step 4: Run Commands On Distrobox Container
You can directly run the commands on a Distrobox container instead of accessing the shell using the syntax shown.
$ distrobox-enter --name container-name -- command
In the following commands, we are displaying the uptime of the container and updating the package lists respectively.
$ distrobox-enter --name debian10-distrobox -- uptime $ distrobox-enter --name debian10-distrobox -- sudo apt update
Step 5: Exporting Applications from Container to Host
In case you have an application inside the Distrobox container that you would like to port to the host system, you can do so using the distrobox-export command. Bur first, access the container’s shell.
$ distrobox-enter --name container-name
Here, we are going to install Flameshot which is a free and open-source cross-platform tool for taking screenshots.
$ sudo apt install flameshot
To export the application to Fedora, we will run the command:
$ distrobox-export --app flameshot
To exit the container, run:
$ logout
Now back to the Fedora host system. To confirm the existence of the application, we will run the search for the application using the Application menu as follows.
Step 6: Cloning a Distrobox Container
Sometimes, you might need to create a duplicate or a clone of a container image. To achieve this, first, stop the running container using the podman command
$ podman stop container_ID
To get the container ID, run the podman ps command to list currently running containers.
$ podman ps
Once the container is stopped, you can create a duplicate as follows. In this example, we are duplicating the debian10-distrobox distrobox to a clone called debian-10-clone.
$ distrobox-create --name debian-10-clone --clone debian10-distrobox
To confirm that the clone has been created, yet again, list the Distrobox containers as shown.
$ distrobox-list
Step 7: Managing Distroboxes in Fedora
In this last section, we will briefly go over how to manage containers using podman.
To list all active containers, run:
$ podman ps
To list all running containers both active and those that have exited, run:
$ podman ps -a
To stop a container, run the command:
$ podman stop container_ID
To remove a container, be sure to stop it first and then remove it.
$ podman stop container_ID $ podman rm container_ID
Conclusion
Distrobox is a handy utility that allows forward and backward compatibility with software applications and also enables you to try out various Linux distributions in form of containers without requiring sudo privileges.
The above is the detailed content of DistroBox – Run Any Linux Distribution Inside Linux Terminal. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

There are three ways to create empty files in the command line: First, the simplest and safest use of the touch command, which is suitable for debugging scripts or placeholder files; Second, it is quickly created through > redirection but will clear existing content, which is suitable for initializing log files; Third, use echo"> file name to create a file with an empty string, or use echo-n""> file name to avoid line breaks. These three methods have their own applicable scenarios, and choosing the right method can help you complete the task more efficiently.

Are you looking for good software to write mathematical equations? If so, this article provides the top 5 equation editors that you can easily install on your favorite Linux distribution.In addition to being compatible with different types of mathema

Eclipse is a free integrated development environment (IDE) that programmers around the world use to write software, primarily in Java, but also in other major programming languages using Eclipse plugins.The latest release of Eclipse IDE 2023?06 does

Linux administrators should be familiar with the command-line environment. Since GUI (Graphical User Interface) mode in Linux servers is not commonly installed.SSH may be the most popular protocol to enable Linux administrators to manage the servers

Linux has a rich collection of commands, and while many of them are powerful and useful for various tasks, there are also some funny and whimsical commands that you can try out for amusement. 1. sl Command (Steam Locomotive) You might be aware of the

PPA is an important tool for Ubuntu users to expand their software sources. 1. When searching for PPA, you should visit Launchpad.net, confirm the official PPA in the project official website or document, and read the description and user comments to ensure its security and maintenance status; 2. Add PPA to use the terminal command sudoadd-apt-repositoryppa:/, and then run sudoaptupdate to update the package list; 3. Manage PPAs to view the added list through the grep command, use the --remove parameter to remove or manually delete the .list file to avoid problems caused by incompatibility or stopping updates; 4. Use PPA to weigh the necessity and prioritize the situations that the official does not provide or require a new version of the software.

Gogo is a remarkable tool to bookmark directories inside your Linux shell. It helps you create shortcuts for long and complex paths in Linux. This way, you no longer need to type or memorize lengthy paths on Linux.For example, if there's a directory

The key to installing dual systems in Linux and Windows is partitioning and boot settings. 1. Preparation includes backing up data and compressing existing partitions to make space; 2. Use Ventoy or Rufus to make Linux boot USB disk, recommend Ubuntu; 3. Select "Coexist with other systems" or manually partition during installation (/at least 20GB, /home remaining space, swap optional); 4. Check the installation of third-party drivers to avoid hardware problems; 5. If you do not enter the Grub boot menu after installation, you can use boot-repair to repair the boot or adjust the BIOS startup sequence. As long as the steps are clear and the operation is done properly, the whole process is not complicated.
