How to quickly deploy a Linux distribution with GUI applications via a container – TechRepublic

Register for your free TechRepublic membership or if you are already a member, sign in using your preferred method below.
We recently updated our Terms and Conditions for TechRepublic Premium. By clicking continue, you agree to these updated terms.
Invalid email/username and password combination supplied.
An email has been sent to you with instructions on how to reset your password.
By registering, you agree to the Terms of Use and acknowledge the data practices outlined in the Privacy Policy.
You will also receive a complimentary subscription to TechRepublic’s News and Special Offers newsletter and the Top Story of the Day newsletter. You may unsubscribe from these newsletters at any time.
Username must be unique. Password must be a minimum of 6 characters and have any 3 of the 4 items: a number (0 through 9), a special character (such as !, $, #, %), an uppercase character (A through Z) or a lowercase (a through z) character (no spaces).
How to quickly deploy a Linux distribution with GUI applications via a container
Your email has been sent
If you need to spin up a quick Linux desktop for development or testing purposes, one of the easiest is with a new tool called Distrobox. Jack Wallen shows you how.
I frequently need to spin up a Linux virtual machine for numerous reasons. Most often I’ve used VirtualBox, but sometimes that can be a bit of a convoluted mess, especially if I need to share some resources between host and guest. That’s where a tool like Distrobox comes in handy.
SEE: 40+ open source and Linux terms you need to know (TechRepublic Premium)
Distrobox makes it possible to deploy a mutable Linux container from the terminal window and run full-blown GUI applications from the guest on the host from a simple container. Once deployed, those containers have access to host resources, such as the user’s HOME directory, external storage and USB devices, graphical apps (X11/Wayland) and audio. More importantly, going this route uses fewer system resources than, say, VirtualBox.
The one caveat is that Distrobox is only supported on Linux.
So, how is this done? It’s actually pretty easy.
To make this happen, you’ll need a running instance of a Linux desktop and a user with sudo privileges. I’ll be demonstrating on Ubuntu Desktop 20.04.
The first thing we must do is install Docker. Log into your desktop, open a terminal window, and install both Docker and curl with:
sudo apt install docker.io curl -y
Once the installation completes, start and enable the Docker service with:
sudo systemctl enable --now docker
Add your user to the docker group with:
sudo usermod -aG docker $USER
Finally, make the system aware of the changes with:
newgrp docker
With Docker and curl installed, you can now download the installer file with the command:
curl https://raw.githubusercontent.com/89luca89/distrobox/main/install > install
Give the install file executable permissions with:
chmod u+x install
If the ~/.local/bin directory doesn’t exist, create it with:
mkdir -p ~/.local/bin
Now, we’ll run the installer (and instruct it to install everything in the newly created ~/.local/bin directory) with:
./install -p ~/.local/bin
You should now see all of the Dockerbox commands in ~/.local/bin. However, that directory is not currently in our path, so we add it with:
PATH=$PATH:~/.local/bin
Close the terminal and reopen it.
Let’s deploy the latest version of Arch Linux with Distrobox, to see how this works.
First, we must pull the latest version of Arch from the repository with the command:
distrobox create --image archlinux:latest --name arch
Once the pull completes, we can start and enter the container with:
distrobox enter --name arch
You should find yourself on the Arch Linux bash console. Now the fun begins. Let’s install Firefox into the running container with the command:
sudo pacman -S firefox
Answer all of the questions with the defaults and eventually, once the installation completes, you’ll be returned to the terminal. Now, we can run Firefox from within the terminal window, only the browser window will appear on the host desktop. To do that, issue the command (from within the container):
firefox
The Firefox window will open (Figure A) and you can start browsing as though it were running on the host.
Figure A
If you’re not convinced (because Firefox is installed on both the host and guest), let’s install something on the guest that’s not on the host. Open a second terminal on the host and issue the command:
atom
You should see the command is not found (Figure B).
Figure B
Close Firefox and, back at the Arch container prompt, install the Atom text editor with:
sudo pacman -S atom
When the installation completes, start atom with the command (run on the guest):
atom
The Atom editor should open (Figure C).
Figure C
Exit out of the container with:
exit
When you’re finished, you can either leave those containers running (and enter them as needed) or remove them. First, list out all of your running containers with:
distrobox list
Locate the container you want to remove and do so with:
distrobox-rm --name CNAME
Where CNAME is the name of the container to be deleted.
And that’s all there is to deploying containers and running GUI applications from them with the help of Distrobox. I’m confident you’ll find plenty of ways to make use of this impressive tool.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.
Our editors highlight the TechRepublic articles, downloads, and galleries that you cannot miss to stay current on the latest IT news, innovations, and tips.
How to quickly deploy a Linux distribution with GUI applications via a container
Your email has been sent
Your message has been sent
In his final TechRepublic video, Bill Detwiler reflects on his more than 20 years of working on the brand and interviews Tamara Scott about what excites her about being Managing Editor of TR.
In these training courses, you’ll learn basic Linux system administration; then, you’ll get familiar with the Linux command line and understand the foundations of how Linux works.
Replacing a desktop or laptop computer with an iPad, whether the system is a Windows machine or a Mac, is no longer a stretch. These 10 steps will make the iPad Pro migration go smoothly.
PDF Converter Pro is an all-in-one tool that allows you create or convert PDF documents into a variety of formats or from a variety of formats with ease.
Tired of Gmail and you’d rather not touch Outlook? If so, what services and/or clients can you use for email communication? Jack Wallen offers up his five favorites.
If you’re looking for an alternative office suite, there are several choices to be found. Jack Wallen offers his five favorites that aren’t Office 365 or Google Workspace.
It’s critical to plan Microsoft 365 apps and services deployments on Macs properly to avoid end-user frustrations. There are so many elements to consider that forward-thinking IT professionals should consider employing a checklist. With proper administration, IT departments can ensure important tasks aren’t overlooked, and users don’t need to return systems to the help desk …
When computer systems fail, business grinds to a halt, and that can cost your enterprise a considerable amount of money. With the help of TechRepublic Premium’s Systems Downtime Expense Calculator, you can estimate just how much each system failure is going to cost you. When to use this tool Even if the entire business does …
Results from the latest TechRepublic Premium survey suggest that businesses continue to deploy multicloud solutions, but the IT pros who support them are uncertain how they’ll change in the future. From the introduction: Heading into the third year of the COVID-19 global pandemic, industries, businesses, consumers and the information technology professionals who support them are …
This TechRepublic Premium download includes a checklist for PC and Mac migrations to minimize frustrations and improve productivity. Regardless of the process, there are several elements to track when replacing an existing computer with a new system. Whether your organization begins by imaging drives or manually configures new systems, many questions must be addressed, including: …

source