Docker

Docker packages an application together with its entire userspace environment — OS libraries, compilers, Python versions, CUDA toolkits — into a container image that runs identically on any Linux host. For SLAM work, this solves the single most common practical frustration in the field: research code that only builds against one specific combination of Ubuntu, OpenCV, Eigen, Ceres, and ROS versions.

A typical SLAM Dockerfile pins exactly that combination:

FROM ros:humble
RUN apt-get update && apt-get install -y \
    libeigen3-dev libopencv-dev libceres-dev \
 && rm -rf /var/lib/apt/lists/*
COPY . /ws/src/my_slam
RUN cd /ws && . /opt/ros/humble/setup.sh && colcon build

And a typical development run invocation combines most of the flags you will ever need:

docker build -t my_slam .
docker run -it --rm \
  --gpus all \                              # NVIDIA Container Toolkit: GPU inside
  -v ~/data:/data \                         # datasets live on the host
  -v $(pwd):/ws/src/my_slam \               # live-edit source from the host
  -e DISPLAY=$DISPLAY \
  -v /tmp/.X11-unix:/tmp/.X11-unix \        # X11 forwarding for visualizers
  --network host \                          # ROS discovery across host/container
  my_slam bash

Key ideas to be comfortable with:

Beyond the basics

In practice, almost every serious open-source SLAM repository now ships a Dockerfile, and reproducing a paper’s results usually starts with docker build. Docker is also how SLAM is evaluated at scale: CI pipelines run dataset benchmarks inside containers, and robots increasingly deploy their perception stack as containers for clean updates and rollbacks.

Common pitfalls

Why it matters for SLAM

SLAM systems have notoriously heavy and brittle dependency stacks (specific OpenCV/Eigen/Ceres/ROS versions that conflict between projects). Docker lets you keep ORB-SLAM3, VINS-Fusion, and a PyTorch-based front-end on one machine without their dependencies fighting, makes your own research reproducible for others, and is the standard packaging unit for both CI benchmarking and deployment on real robots.