Docker, RF, SDR, Software

Simple GNURadio Server Setup with noVNC Docker

I have been using GNURadio since college, and even now just getting the software installed and working with your hardware radio can be a challenge. So I decided to create a Docker image that not only has GNURadio installed but can be accessed via VNC in a browser tab. This allows this container to be installed on a remote radio server and be accessed over the internet easily.

Docker containers are essentially lightweight virtual machines that can be transported from machine to machine to allow for easy installation of complex software stacks. This could be a development environment for a product, application or service hosting, and many more.

Creating the Docker Image

The cool thing about Docker and containers is that they can be built off each other. So while you can start from a base image of a Linux distribution you can also start from someone else’s container image that is already built for a specific purpose. With this in mind, I decided to start from a container image that had already done the hard work of setting up the noVNC web service. noVNC is a virtual desktop that can be used in the browser instead of relying on a dedicated application like RealVNC.

The base image can be downloaded from the Docker Hub link below.

DockerHub: dorowu/ubuntu-desktop-lxde-vnc

docker pull dorowu/ubuntu-desktop-lxde-vnc:latest

This Docker image can also be built from the source using the GitHub link, I was never able to get it to build successfully and it takes forever as well. So your mileage may vary if you go this route.

GitHub: fcwu/docker-ubuntu-vnc-desktop

Now to get to the interesting stuff, GNURadio! For this, I decided to reference another Docker container that also installed GNURadio. Their Dockerfile and repo can be found on GitHub as well.

GitHub: git-artes/docker-gnuradio

This build installs GNURadio 3.9 so be aware of that for any out-of-tree modules you also want to use later on. I wrote up the Dockerfile used for my build image. The Dockerfile defines all the pieces you want to be included in your container and the order you want them to be done. This could be simple apt install commands, git clones, make commands etc.

FROM dorowu/ubuntu-desktop-lxde-vnc:latest

#gnuradio setup
RUN apt-get update

# else it will output an error about Gtk namespace not found
RUN apt-get install -y gir1.2-gtk-3.0

# to have add-apt-repository available
RUN apt-get install -y software-properties-common

RUN add-apt-repository -y ppa:gnuradio/gnuradio-releases-3.9

RUN apt-get update

RUN apt-get install -y gnuradio

# installing other packages needed for downloading and installing OOT modules
RUN apt-get install -y gnuradio-dev cmake git libboost-all-dev libcppunit-dev liblog4cpp5-dev python3-pygccxml pybind11-dev liborc-dev

ENV PYTHONPATH "${PYTHONPATH}:/usr/local/lib/python3/dist-packages"

then you can build the container with the following Docker command, tagging the build as the latest.

docker build . -t <user-name>/gnuradio-docker-ubuntu-vnc-desktop:latest

You can copy the Dockerfile here or clone the git repo below if you want to modify the image with custom modules.

GitHub: Tschucker/gnuradio-docker-ubuntu-vnc-desktop

Docker Hub

I wanted to make sure this Docker image was available to anyone that wanted to install it on their server. For this, I used Docker Hub which is a simple way to store and share Docker images with others. It is free for publicly available images but you can get a paid account if you want to host private images on it. Signup for an account and create a repository for your image.

Then to push an image up to the Docker Hub you first need to log in from the command line and then you can push the image up to the Docker Hub repo.

docker login -u <user-name>
docker push <user-name>/gnuradio-docker-ubuntu-vnc-desktop:latest

You can get my GNURadio VNC Docker container from my Docker Hub account below.

DockerHub: tdsepsilon/gnuradio-docker-ubuntu-vnc-desktop

Docker Hub Help

If you need more help with this, here are a few links that I used to get the job done.

Server Setup with CasaOS

I have been currently setting up a small server using the newly released Zima board SBC. This board ships with a new server management OS called CasaOS. It is still in its early days of development but has a great feature for installing Docker containers. They have a few preconfigured ones in a pseudo app store, but you can also install your own drawing from Docker Hub.

Open up the app store to install a new container.

Once you select the Custom install button a window will open where you can fill in the information similar to below. you may need to change any volumes you want to be mounted to the container. I have one so that I can easily store my grc files and radio data.

You can also choose to use this JSON file to upload the configuration (using the button next to the x in the top right of the window) and tweak it from there. Just remove the .txt extension, leaving the .json one.

The other thing to note in this configuration is that we want to pass our radio device into the container. This involves setting the USB path but also making sure that the device is blacklisted on the server. This blacklisting makes sure that the server does not instantiate drivers for that device, if not blacklisted the device will not show up in the container.

To do this for the RTLSDR create a blacklist.conf file in the directory below.

/etc/modprobe.d/blacklist.conf

Then edit it to include the following, you may need to reboot to make sure no drivers are loaded for your RTLSDR device.

blacklist dvb_usb_rtl28xxu
blacklist rtl2832
blacklist rtl2832_sdr

Once that is done start your container by clicking on it in CasaOS it may take a few seconds to boot and connect the VNC. from there you can launch GNURadio from the terminal or from the Start menu in the bottom left. I created a quick RTLSDR flowgraph just to make sure things were running as expected.

Twitter video proof

Conclusion

This was my first time building my own container and uploading it to Docker Hub, I was also pleasantly surprised by how easy it was to get set up on the Zima Board server using CasaOS. In the future look out for more content using the Zima Board and CasaOS as I think the idea and the execution are really coming together for personal server deployment.