This tutorial is designed as a basis for further projects written using the ROS framework. Here we create containers for quick and convenient work in them. Containers can be launched separately manually via Dockerfile or via docker-compose, depending on the preference and the necessary functionality. It also describes the settings for using GUI applications inside Docker.
- Get Docker desktop installed and running by following this Guide
- Ensure WSL-2 is installed or upgraded from WSL-1 from this link
- Install VcXsrv Windows X Server from this link
Before starting the container, you need to configure and start the X server (VcXsrv). Using the VcXsrv its a simple approach to connect GUI in Docker container and localhost machine. You can learn more here.
Detailed configuration of ROS GUI support. If you want more setting read here.
If you want to use docker-compose in your projects. Build containers.
docker-compose build
- Run containers.
docker-compose up
In order to use docker-compose tools correctly, you should study docker-compose.yml and also refer to the technical documentation. In this repository, I used environment variables that are rendered in this file .env . They are used when building containers, as well as when launching containers via docker-compose.
All the necessary dependencies for Python are placed in the requirements folder. There are 2 files in this folder common.txt this is a file with the main dependencies and developmet.txt which contains files for debugging if necessary. This is done in order to use a container for production.
Useful source source of information Github.
If such an error occurs, it means that an incorrect command was entered or such a module is not installed
/ros_entrypoint.sh: line 6: exec: rviz: not found
- Running a container with GUI enabled for Windows
docker run -it --name <container name> -e DISPLAY=host.docker.internal:0.0 bin/bash
- Creating a interactive container from image
docker run -it <image name>
- Giving Name to a container while creating
docker run --name <container name> <image name>
- Start a stopped Container
docker start (container_id)
- Connect shell to running container
docker exec -it (container_id) bin/bash
- Terminal from same directory
docker built -t <image name > .