This repository contains a ready-to-use ROS 2 Humble workspace inside a VS Code Dev Container.
It ensures that everyone has the same development environment without worrying about operating system differences.
- To ensure the installation, open PowerShell and
docker --versionshould print the docker version. - During installation, enable WSL2 backend.
- After installation, open Docker Desktop → Settings → Resources → WSL Integration → enable your Ubuntu distribution.
- Install Docker Engine following official instructions: Install Docker Engine on Ubuntu
Sometimes running Docker commands may fail with a permission denied error:
docker: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock
This happens when your user doesn’t have access to the Docker daemon.
- Add your user to the
dockergroup:
sudo usermod -aG docker $USER- Apply the new group membership:
newgrp docker- Test Docker:
docker run hello-world💡 You may need to log out and log back in (or restart VS Code) for the changes to take effect. if the issue still presists on VS Code:
- Open your terminal
- Navigate to your cloned repo directory
-
newgrp docker docker run hello-world code .
- Ensure your WSL2 Ubuntu distribution is enabled in Docker Desktop:
- Open Docker Desktop → Settings → Resources → WSL Integration.
- Enable your Ubuntu distribution.
- Restart your VS Code or open a new terminal inside the WSL2 Ubuntu session.
- Test Docker:
docker run hello-world✅ After following these steps, your user should be able to run Docker commands without sudo (Linux) or permission issues (Windows WSL2).
git clone <your-repo-link>
cd <repo-name>-
Open the repo folder in VS Code.
-
Press Ctrl+Shift+P → search for Dev Containers: Rebuild and Reopen in Container.
-
Wait while Docker builds the image (first build may take ~10–15 minutes).
-
Once you're connected, notice the green remote indicator on the left of the Status bar to show you are inside the dev container:
By default, your ROS 2 workspace is located at:
~/ros2_wscd ~/ros2_ws
colcon build
source install/setup.bash💡 Tip: Add this line to your ~/.bashrc so ROS 2 sources automatically in every terminal:
source ~/ros2_ws/install/setup.bashRun this command:
echo $ROS_DISTRO