This document describes the setup process for a developing with a ROS environment Docker container.
Follow the instructions according to your platform:
Linux
Tools
Instructions
These instructions are written for Ubuntu, steps may vary if using a different distribution.
- Install git:
sudo apt install git
- Install VS Code: https://code.visualstudio.com/docs/setup/linux
- Install Docker Engine: https://docs.docker.com/engine/install/ubuntu
- Set up SSH keys: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?platform=linux
- Clone the repository:
git clone git@github.com:WisconsinRobotics/WRoverPlayground.git
- Open the repository in VS Code
- Clone git submodules:
git submodule update --init --recursive
- Install the VS Code Dev Containers Extension
- In the VS Code Command Palette (F1), run
Dev Containers: Open Folder in Container
Troubleshooting
NOTE: Please do not commit .devcontainer/devcontainer.json
if you need to modify it according to the following troubleshooting steps.
- After trying to run a GUI app, the following error is encountered:
Authorization required, but no authorization protocol specified
. To fix this, try xhost +localhost
, and see if the issue is resolved. If not, run xhost +
. Since these command allow connections to your local X server, you may want to revert them with the corresponding xhost -localhost
or xhost -
after you are done using the devcontainer.
- After opening the devcontainer, a SELinux AVC denial is encountered. The workaround is running
chcon -Rt svirt_sandbox_file_t /path/to/WRoverPlayground
. Documented here: https://github.com/microsoft/vscode-remote-release/issues/1333
- After trying to run a GUI app, a SELinux AVC denial is encountered. To fix this, add
"--security-opt=label=type:container_runtime_t"
to the runArgs
in devcontainer.json
.
- If you are using Podman as a replacement for Docker, you will need to add
"--userns=keep-id"
to the runArgs
in devcontainer.json
. Podman is not officially supported.
macOS
Tools
Instructions
Apple Silicon Mac users should upgrade to macOS Ventura or newer.
- Check if git is already installed by running
git --version
in the terminal
- If git is not installed, and you are not prompted to install Xcode Command Line Tools, run
xcode-select --install
- Install VS Code: https://code.visualstudio.com
- Install Docker Desktop: https://www.docker.com/products/docker-desktop
- Apple Silicon users, follow the troubleshooting steps below to configure Docker for running ROS C++ programs
- Install XQuartz: https://www.xquartz.org
- Open XQuartz, and select XQuartz > Preferences
- Under the "Security" tab, check "Allow connections from network clients"
- Restart your Mac and open XQuartz
- In the terminal, run
xhost +
. You may need to rerun this every time you open XQuartz.
- Set up SSH keys: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?platform=mac
- Clone the repository:
git clone git@github.com:WisconsinRobotics/WRoverPlayground.git
- Open the repository in VS Code
- Clone git submodules:
git submodule update --init --recursive
- Install the VS Code Dev Containers Extension
- In the VS Code Command Palette (F1), run
Dev Containers: Open Folder in Container
Troubleshooting
- Apple Silicon Macs cannot run ROS C++ programs (requires macOS Ventura or newer)
- Open Docker Desktop
- Go to Settings (top right corner)
- Go to "Features in Development"
- Scroll down and check "Use Rosetta for x86/amd64 emulation on Apple Silicon"
- Click "Apply and Restart"
- X11 forwarding instructions: https://gist.github.com/sorny/969fe55d85c9b0035b0109a31cbcb088
Windows
Tools
Instructions
These instructions are written for Windows 10 version 2004 or higher and Windows 11.
- Open PowerShell or Command Prompt as Administrator
- Run
wsl.exe --install
and restart if WSL is not already installed
- If WSL is already installed, run
wsl.exe --update
- Check that WSL 2 is in use with
wsl.exe -l -v
- Install git: https://git-scm.com/downloads
- Install VS Code: https://code.visualstudio.com
- Install Docker Desktop: https://www.docker.com/products/docker-desktop
- Set up SSH keys: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?platform=windows
- Open WSL by running
wsl.exe
in PowerShell or Command Prompt
- In WSL, set up SSH keys: https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent?platform=linux
- In WSL, clone the repository:
git clone git@github.com:WisconsinRobotics/WRoverPlayground.git
- Open Docker Desktop
- Open VS Code
- Install the VS Code WSL Extension and Dev Containers Extension
- In the VS Code Command Palette (F1), run
WSL: Connect to WSL
- Open the repository
- Clone git submodules:
git submodule update --init --recursive
- In the VS Code Command Palette (F1), run
Dev Containers: Open Folder in Container
Troubleshooting