Simple example of LXC running nmap from Bluefin-DX

Background

Still on the developer experience tour of Bluefin-DX, I wanted to give it a try to LXC. Heard about it but never used it. More on the VirtualBox, VMWare, Docker crowd.

But since I was doing research on the different ways to install Linux applications in Bluefin-DX, I decided it was the turn of LXC.

Objective

This is about the installation of a simple terminal application nmap in a LXC container, and running it from the Bluefin-DX host.

Experiment

Let’s create a privileged container (with sudo) from the Bluefin-DX host:

sudo lxc-create -t download -n ubuntu-c1 -- -d ubuntu -r jammy -a amd64
sudo lxc-ls --fancy

image

Start the coontainer:

sudo lxc-start ubuntu-c1   

image

Attach the container to a console:

sudo lxc-attach ubuntu-c1

image

Then, inside the Ubuntu container we install nmap:

sudo apt update -y && sudo apt upgrade -y 
sudo apt install nmap -y
exit                               # back to the host

We stop the LXC container:

# to run commands from the host we need it idle
sudo lxc-stop ubuntu-c1  

Results

Now, from the Bluefin-DX host, we run:

sudo lxc-execute ubuntu-c1 -- nmap --version

We have demonstrated that terminal binaries can be installed in LXC container and be executed from the host.

Next

Next challenge: run GUIs from LXC from Bluefin-DX.

4 Likes

I love these KISS & straightforward guides that help to get started with a new tech quickly :raised_hands:

Learning by doing is my motto!