Docker + Perplexica + Snap + Firefox in a GUI-enabled Incus Container (AI)

AI Tutorial: Docker + Perplexica + Snap + Firefox in a GUI-enabled Incus Container

“Perplexica is an open-source AI-powered searching tool or an AI-powered search engine that goes deep into the internet to find answers.”

In this tutorial, we will learn:

  1. How to set up a GUI-enabled incus container

  2. Configure a docker-enabled device

  3. Install Docker in an incus container

  4. Install Perplexica in an incus container

  5. Install snap firfox to launch Perplexica

Set up a GUI-enabled Incus Container

This tutorial assume we work with a container named ‘ub’ that supports GUI applications. you may change the container name ‘ub’ to your own ones.

To set up a GUI-enabled Incus Container, read one of the following examples:

Running GUI Apps via Incus on Ubuntu 22.04 LTS

Running GUI Apps via Incus on Ubuntu 24.04 LTS

Configure a Docker Device

  1. Create a btrfs storage pool

  2. Create a volume to work with docker

  3. Attach the volume to an incus container

  4. Restart container to make new configurations effective.

Run in HOST:


# Create a btrfs storage pool, as docker does not run well with the default zfs file system

incus storage create btrfspool btrfs

# Create a volume to work with docker

incus storage volume create btrfspool docker

# Attach volume 'docker' to container 'ub'

incus config device add ub docker disk pool=btrfspool source=docker path=/var/lib/docker

# Configure security options to work with docker

config set ub security.nesting=true security.syscalls.intercept.mknod=true security.syscalls.intercept.setxattr=true

# Restart container 'ub'

incus restart ub

Log in a GUI-enabled Incus Container

Run in HOST:


incus exec ub -- sudo --login --user ubuntu

Install Docker

Run in CONTAINER:

  1. Set up Docker’s apt repository:

# Add Docker's official GPG key:

sudo apt-get update

sudo apt-get install ca-certificates curl

sudo install -m 0755 -d /etc/apt/keyrings

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:

echo \

"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \

$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \

sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update

  1. Install the latest version

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

  1. Add user to docker group

sudo usermod -aG docker $LOGNAME

newgrp docker

Install Git and Perplexica

Run in CONTAINER:


sudo apt install -y git

git clone https://github.com/ItzCrazyKns/Perplexica.git

cd Perplexica

cp sample.config.toml config.toml

docker compose up -d

Install Snap and Firfox

Run in CONTAINER:


sudo apt install -y snapd

sudo snap install firefox

Launch Perplexica

Run in CONTAINER:


firefox localhost:3000

Configure Perplexica settings by first clicking the ‘wheel’ button at the left bottom corner.

Launch from Host

Run in HOST:

  1. Set aliases

nano ~/.bashrc

Add the following content at the end of the file


alias ub="incus exec ub -- sudo --login --user ubuntu"

alias perplexica="incus exec ub -- sudo --login --user ubuntu firefox localhost:3000 &>/dev/null & disown"

source ~/.bashrc

  1. To launch Perplexica from host, run either:

ub firefox localhost:3000

or

perplexica

References

https://ubuntu.com/tutorials/how-to-run-docker-inside-lxd-containers#1-overview

2 Likes

That project is pretty slick. But why run Firefox here? It would make sense to expose to your network as these are just web servers.

These articles are advertisements for AI software, and there’s virtually nothing incus specific to them.

In my opinion the incus discussion list should not be allowed to become someone’s personal blog, and I see this as noise I could well do without. But maybe that’s just me.

Even articles specifically about how to use incus would be best put into blog posts though.

There’s Perplexity ($$$) and there’s Perplexica (open-source alternative).

Perplexica is an AI-powered search engine. It is an Open source alternative to Perplexity AI

This tutorial is a task that makes use of features of Incus. In educational terms it helps people (that choose to perform this tutorial) to go through the steps and learn them. They can reuse those steps for other software setups. From me it’s :+1:.

1 Like

Sure, it’s an advertisement for an open source AI platform.

I object because I don’t think discuss.linuxcontainers.org should be bulletin board for advertising people’s pet projects. It doesn’t matter whether they are commercial or not.

There’s almost nothing about using incus here (quite a bit about using docker though)

There are different views on how to help an open-source project to grow.
I am open to new views and at the same time I do not keep my views to myself.
My first tutorial relating to Incus (and before, LXD) was in 2016.
Since then, I tried several strategies on how to bring about a positive impact on system containers.

What worked, was to find useful uses for system containers, and explain to people on how to use them. A person wouldn’t need to know yet much about system containers, but would be able to perform an essential task to them. By doing so, they would stick to the project and the project grow.

In 2017 I wrote my first tutorial on running GUI apps. The information for this was out there but you would have needed several hours or days of testing to make it work on system containers. My first tutorial was hackish and perhaps a distraction to system containers. There where no facilities then to make it easier, and your GUI experience was sub-par. Perhaps it would have been better not to write about GUI apps?

This tutorial is a how-to tutorial. It explains how to perform a task. We need such tutorials, in fact we need as many as we can get.

1 Like

Share a bit the background of writing this tutorial. I read official incus documentation about docker setup. However, it fails to support a docker application, like Perplexica. I, then, spent some time to research over the internet and found this solution. That’s why I use Perplexica as an example in this tutorial, in case someone else find the official documentation not enough to run their applications and don’t want to spend extra time as I did.

In this case, simple running localhost:3000 directly on host does not work. The page is only partially loaded on host. The workaround, i.e. running firefox from within the container, saves me from further research time.