Use GUI Programs in Incus Container
Contents
If you’ve ever faced the challenge of running graphical user interface (GUI) programs within a container, fear not! While it may seem like a daunting task at first, with this comprehensive guide, we’ll walk through the process using Incus Container. We will set up and configure your environment to run GUI-based applications seamlessly in a virtualized space. Let’s get started!
Create a GUI profile
To begin, you must create a new profile specifically for managing GUI programs within the Incus container. This can be done using the following command:
|
|
And edit with incnus profile edit gui
. Throw the following contents in and save it.
|
|
We are using host’s display so we will be using sockets.
Add NixOS configuration
Now add the following in configuration.nix
, rebuild and switch.
|
|
This update enables the matching of users and groups between your host machine and container.
Configure default Incus settings
Create or edit the ~/.config/incus/default.conf
file to provide default settings tailored specifically for running GUI applications within an Incus container. Add these configurations to your default.conf
:
|
|
These configurations allow for the proper mapping of GUI applications within Incus and provide mounting entries that correspond to essential devices required by these programs (e.g., graphics card drivers).
On host machine, run
|
|
Add your container to gui
profile:
|
|
Running X Server Inside Your Container:
Now that you’ve set up your profile, it’s time to install an X server inside your container to render graphical elements on the GUI applications. The installation process may vary depending on your distribution and version. For example, if using Arch Linux, run these commands:
|
|
This will install X server components required to render the GUI elements for your applications within Incus.
Executing a GUI Program in Your Container
Finally, let’s test our setup by running an example GUI program inside the container with the appropriate user permissions. To do this, use the following command:
|
|
After executing the above command, you should see a window displaying spinning gears from the GLXGEARS program - indicating that your GUI application is now successfully running within Incus Container.
Happy hacking!
Author Aditya
LastMod 2024-04-28 (82b5302)