What is Docker?#
Docker is an open-source platform that lets you package software and all of its dependencies into a self-contained unit called a container. A container bundles the application code, runtime, system libraries, and configuration files needed to run a piece of software—regardless of the host machine’s operating system or installed packages.
Containers vs. Virtual Machines#
Both containers and virtual machines (VMs) provide isolation, but they differ fundamentally in how they work:
Feature |
Container |
Virtual Machine |
|---|---|---|
Boot time |
Milliseconds |
Minutes |
Disk footprint |
Tens of MB |
Several GB |
OS kernel |
Shared with host |
Full guest OS |
Isolation level |
Process-level |
Hardware-level |
Performance |
Near-native |
Overhead from hypervisor |
Containers share the host operating system kernel, which makes them much lighter and faster than VMs. Each container still has its own filesystem, network stack, and process space, so it remains isolated from everything else running on the machine.
Key Concepts#
Before working with Docker, it is important to understand a few fundamental terms:
Image : A read-only template that defines the container’s contents—operating system, installed packages, environment variables, and startup commands. Think of it as a snapshot or a recipe. Images are immutable; you never modify them directly.
Container : A running instance of an image. You can start many containers from the same image, and each one is isolated from the others. Containers are ephemeral by default—any changes made inside are lost when the container is stopped or removed, unless you explicitly persist them.
Registry : A server that stores and distributes Docker images. The public registry is Docker Hub. PAL Robotics uses the GitLab Container Registry to distribute its images privately.
Volume / Bind mount : A mechanism to share a folder between the host machine and a running container. This is how you persist files across container restarts and share data with your host environment.
Dockerfile : A text file containing the instructions needed to build a Docker image from scratch (or from an existing base image).
Why Docker for Robotics?#
Working with a robot like Kangaroo involves a specific combination of ROS 2 packages, simulation tools, controllers, and system libraries that must be compatible with each other and with the robot firmware. Setting up this environment manually on every developer machine is error-prone and time-consuming.
Docker solves this by:
Guaranteeing reproducibility: every developer and CI pipeline uses exactly the same environment.
Eliminating “works on my machine” issues: the container is the environment.
Enabling fast onboarding: a new team member can be up and running in minutes.
Keeping the host clean: all ROS packages, build tools, and simulation binaries live inside the container and do not interfere with other projects on your laptop.
Containerization Key Properties#
Property |
What it means in practice |
|---|---|
Flexible |
Even complex multi-package ROS workspaces can be containerized |
Lightweight |
Shares the host kernel — no full OS overhead |
Interchangeable |
Swap in a newer image version without touching your host |
Portable |
Build once, run on any Linux machine with Docker installed |
Scalable |
Spin up multiple containers for parallel CI jobs or multi-robot tests |
Stackable |
Compose multiple services (robot driver, simulation, visualizer) together |
Further Reading#
If you want to deepen your understanding of Docker, the official documentation is the best starting point: