Robot Operating System (ROS) is highly tied to a specific Ubuntu version. For example, latest ROS 1 release, Noetic, only officially supports Ubuntu 20.04, while ROS 2 Humble only supports Ubuntu 22.04. Even though building ROS from source is an option, we will need to do the same for every dependencies, that can be installed simply with apt on officially supported distro.
Instead, we can leverage containerization technology to run ROS on any distro, by using Distrobox.
Distrobox is a tool that allows you to create and manage containerized environments using Podman or Docker. It provides a simple interface to create and manage containers, making it easy to run applications in isolated environments. Distrobox is designed to be lightweight and seamlessly integrate with your host system, allowing you to access files and devices from within the container.
This guide uses Ubuntu as an example.
To install Distrobox, you can follow the instructions on the official Distrobox website. The installation process may vary depending on your Linux distribution, but generally involves installing the Distrobox package and its dependencies. It's recommended to use Podman as the container runtime for better performance and rootless containers.
sudo apt install -y curl podman
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sudo shOnce you have Distrobox installed, you can create a container for ROS.
For example,
distrobox create --name ros1 --image docker.io/osrf/ros:noetic-desktop-full
distrobox enter ros1To make it easier to enter the Distrobox container, you can add a function to your .bashrc file. This function will allow you to enter the container with a simple command, as well as set up the necessary environment variables for ROS.
cat << 'EOF' >> ~/.bashrc
alias ros1="distrobox enter ros1"
# Distrobox setup
if [ -n "$DISTROBOX_ENTER_PATH" ] || [ -n "$ON_DISTROBOX" ]; then
# Disable MIT-SHM for Qt applications to avoid issues with shared memory in containers
export QT_X11_NO_MITSHM=1
# Force display to the host's actual display
HOST_DISPLAY=$(distrobox-host-exec printenv DISPLAY 2>/dev/null)
if [ -n "$HOST_DISPLAY" ]; then
export DISPLAY="$HOST_DISPLAY"
fi
# Check if specifically inside the 'ros1' container
if [[ "$CONTAINER_ID" == "ros1" ]]; then
source /opt/ros/noetic/setup.bash
# Set a custom prompt so we know we're in ROS
export PS1="(ROS 1) $PS1"
fi
fi
EOFWarning
Opening a Distrobox container in Visual Studio Code needs the Flatpak version of Visual Studio Code, which can be installed from Flathub. As of February 2026, the deb version of Visual Studio Code does not support opening Distrobox containers with the Dev Containers extension, causing the error "Failed to connect to the container". If you have the deb version of Visual Studio Code installed, you need to uninstall it and install the Flatpak version instead. Beware that Flatpak applications have limited access to the host system, so you may need to adjust the permissions for Visual Studio Code to access your files and devices.
To integrate Distrobox with Visual Studio Code, you can use the Dev Containers extension. This allows you to open a folder inside a Distrobox container and work with it as if it were on your local machine. More information can be found in the official documentation.
Being in a Flatpak, we will need access to host’s podman to be able to use the containers. We can use this wrapper to allow the Flatpak version of Visual Studio Code to access the host's Podman installation, and also set the necessary stuff for the Dev Containers extension to work properly.
Place this in your ~/.local/bin/podman-host. For example:
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/extras/podman-host -o ~/.local/bin/podman-host
chmod +x ~/.local/bin/podman-hostThen, contuinue to installing the Dev Containers extension. And then, open settings (Ctrl + ,) and search for "Docker Path". Set it to the path of the wrapper script you just created, for example:
/home/<youruser>/.local/bin/podman-host
After that, you should be able to open a folder inside the Distrobox container by opening Command Palette (Ctrl + Shift + P) and searching for "Attach to Running Container". Then, select the container you want to attach to (e.g., ros1) and select the folder you want to open.


