This setup provides a Docker container for ROS (Robot Operating System) with a full desktop environment, ideal for robotic development and simulation.
Prerequisites: Ensure Docker is installed on your system before proceeding. Instructions for installing Docker are provided at the end of this document.
- Installation
- Getting Started
- Workspace Setup
- Installing Additional Features
- Docker Installation Instructions
- Uninstalling Docker and Cleaning Up
To clone the repository for your specific ROS distribution, use the appropriate command below:
-
ROS Kinetic:
git clone -b ros_kinetic https://github.com/louislelay/ros_docker.git
-
ROS Melodic:
git clone -b ros_melodic https://github.com/louislelay/ros_docker.git
-
ROS Noetic:
git clone -b ros_noetic https://github.com/louislelay/ros_docker.git
-
Install the Docker Image:
Run the following command to install the Docker image:./install_image.bash
Depending on the power of your computer, this process may take some time. However, once it's done, any future changes you make to this file will be much faster.
-
Start the Docker Container:
Launch the Docker container using this command:./start_docker.bash
-
Exit the Docker Container:
To exit the container, typeexit
.
The home
directory is shared between your computer and the Docker container, ensuring that files persist after you exit the container. To set up your ROS workspace:
- Create a
catkin_ws
directory inside thehome
folder. - Inside
catkin_ws
, create asrc
directory. - You can now develop ROS packages within the
src
folder.
Changes made within the Docker container are temporary. To make changes permanent:
- Add the required installation commands to the
Dockerfile
. - Rebuild the Docker image by running:
./install_image.bash
-
Remove Old Docker Packages:
sudo apt-get remove -y docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc
-
Update Package List:
sudo apt-get update
-
Install Essential Packages:
sudo apt-get install -y ca-certificates curl gnupg
-
Add Docker’s Official GPG Key:
sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg
-
Set Up Docker Repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo $VERSION_CODENAME) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Update Package List Again:
sudo apt-get update
-
Install Docker:
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
-
Run Docker Without Sudo:
sudo groupadd docker sudo usermod -aG docker $USER newgrp docker
-
Verify Docker Installation:
docker run hello-world
-
Uninstall Docker Packages:
sudo apt-get purge -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras
-
Remove Docker Data:
sudo rm -rf /var/lib/docker sudo rm -rf /var/lib/containerd