Containers
Containers are lightweight, portable, and self-sufficient environments that encapsulate an application and its dependencies. They provide a consistent runtime environment across different systems, making it easier to develop, test, and deploy applications.
Why use a container? Typically, when software is developed, it relies on specific versions of libraries, tools, and configurations. This can lead to "it works on my machine" problems when the software is run on different systems. Containers solve this problem by packaging the application along with all its dependencies into a single unit that can run consistently across various environments.
Using the Autonomous Driving Container
The Autonomous Driving Platform provides a simple wrapper on the popular Docker containerization. The provided ./container script is in the ~/roboracer_ws. Prior to running any shell command related to the Autonomous Driving Platform, you should first start the container by running:
cd ~/roboracer_ws
./container shell
Note: editing files with vim and running git commands should be done outside the container. The container is configured to share the workspace files with your host machine, so any changes made outside the container will be reflected inside the container.
If you want to update the dependencies for your car, you can install them in the container by modifying the docker/Dockerfile.jetson and rebuilding the container with:
./container build
Note: All ros2 commands need to be run inside the container. If something is not working, be sure that you're inside the container by running
./container shellfrom theroboracer_wsdirectory. Once you're in the container, your terminal prompt will change to show:[docker]:orin@orin03:~/roboracer_ws$, whereorin03is the hostname of the car. .
Troubleshooting
Docker command not found
If you see the following error when trying to run the ./container script, reinstall Docker using the command: sudo apt install -y docker-ce.
orin@orin12:~/roboracer_ws$ ./container shell
./container: line 56: docker: command not found
./container: line 108: docker: command not found
./container: line 121: docker: command not found