Install Docker and VS Code on Ubuntu 22.04

Setup Ubuntu 22.04: Docker and VS Code

Goal

An Ubuntu 22.04 machine that builds and runs the whole lab — no native ROS2 installation required.

What You Will Build

Docker Engine + compose plugin (rootless-friendly), VS Code with Dev Containers.

Why This Matters

Even on Ubuntu — where you could install ROS2 natively — the lab standardizes on Docker: identical environments for every student, no "works on my machine", and the same workflow that later ships perception containers to a Jetson in Module 9. (If you already have ROS2 Humble installed natively, fine — it will simply not be used by the main path, and it won't conflict.)

Architecture Layer

Environment / tooling.

Files You Will Touch

  • docs/ubuntu_setup.md — the full guide with the apt commands.

Files You Should Not Touch Yet

Everything else.

Commands

# After following docs/ubuntu_setup.md:
docker --version
docker compose version
docker run --rm hello-world     # must work WITHOUT sudo
xhost +local:                    # allow GUI from local containers

Step-by-Step Instructions

  1. Install Docker Engine + compose plugin from Docker's official repository (exact commands in docs/ubuntu_setup.md).
  2. Add yourself to the docker group: sudo usermod -aG docker $USER, then log out/in.
  3. Verify the three commands above.
  4. Install VS Code + the Dev Containers extension.

What You Should See

hello-world prints its message without sudo; docker compose version shows v2.x.

How to Modify This for Your Own Application

Identical stack for any ROS2 project. If you later add an NVIDIA GPU: nvidia-container-toolkit + the commented GPU block in docker/compose.yaml.

Common Mistakes

  • Installing docker.io from Ubuntu's default repo (old version, no compose v2) instead of Docker's official repo.
  • Forgetting to re-login after usermod — the docker group is read at login.
  • Wayland sessions with stubborn GUI issues → try an "Ubuntu on Xorg" session (login screen gear icon).

Checkpoint

docker run --rm hello-world works without sudo.

Expected Output

Ready toolchain.

Next Step

07_clone_the_repo_and_run_lab_doctor.md

If you have any problem here remember that you have the full guide inside the repository: docs/ubuntu_setup.md

Complete and Continue  
Discussion

0 comments