Welcome to ROSMASTER A1 repository
5.Enter Docker (For JETSON Nano and RPi 5)
Entering Docker
This lesson is for the Raspberry Pi 5 and Jetson Nano boards. The Orin board does not require Docker.
Conceptual Understanding:
We refer to the Raspberry Pi/Jetson Nano main environment as the host, and the Docker environment as Docker. Except for the communication agent, which runs on the host, all other programs on the Raspberry Pi/Jetson Nano run within Docker. The host terminal displays the username "jetson/pi," while the Docker user name is "root."
1. Entering Docker for the First Time
Upon startup, the Raspberry Pi 5 and Jetson Nano boards automatically launch the Docker handle startup program (run_humble.sh) and mount the USB controller connected to Docker. To ensure the smooth operation of the handle startup program, this Docker is not mounted with the voice module, myserial, and other devices. Therefore, you cannot use this Docker for subsequent program runs. You will need to use a script to start a new Docker with multiple mounted devices.
Enter Docker (before entering, ensure the voice module and control board are connected to the mainboard/hub).
xxxxxxxxxxsh ~/run_humble.sh
After entering the Docker terminal, the current directory is /. Generally, we need to enter commands in the /root directory. Therefore, enter cd` in the Docker terminal and press Enter to navigate to the /root directory to view files.
Accessing the Same Container from Multiple Terminals:
Since the Docker container that starts automatically at startup only has one terminal, it is impossible to enter other commands in one terminal simultaneously. We need to know how to use multiple terminals to run within a container simultaneously.
Enter the following command on the Raspberry Pi 5 and Jetson Nano to query information about the container generated when first entering Docker.
xxxxxxxxxxdocker ps

As shown in the image above, the above content appears. The image displayed is 192.168.2.51:5000/ros-humble-a1:1.0.0, which matches the image name in our run_humble.sh script. This indicates that this is the container generated by executing sh run_humble.sh. Its name is intelligent_sutherland. Each generated name may be different, so use the one you specify. As long as the image name matches, it will be sufficient. We will use this container name to enter Docker later.
Enter the container on the host machine by entering the following command:
xxxxxxxxxxdocker exec -it intelligent_sutherland /bin/bashChange the name of the generated container to intelligent_sutherland. Press Enter to enter the Docker terminal. This is the terminal for the first Docker container you started. Subsequent program commands will need to be entered in this Docker container terminal.
2. Non-First Entry
2.1 Entering a Previous Docker Container After Restarting
Sometimes, we modify code in a Docker container we entered for the first time and then restart or shut down the system. If we enter Docker using the same method as for the first time, we will find that all the changes we made will be lost. This is because we restarted a new Docker container, so naturally, the changes are not present. If we need to re-enter the Docker container after shutting down the system, we must first follow these steps: Query the Docker container name, Restart the Docker container, and Enter the Docker container.
Enter the following command to query the first Docker container you entered:
xxxxxxxxxxdocker ps -aThis lists all containers, including those currently running and those not running. We can determine which container to start based on the first time we entered the Docker container. For example, I started the car Docker container three weeks ago, and the container name I found is loving_kirch, as shown below.

Then, enter the command in the terminal to restart the car Docker container:
xxxxxxxxxxdocker restart intelligent_sutherland
Change the name of the intelligent_sutherland container based on the actual container name you queried. This command only needs to be run once after the car is restarted.
Enter the following command in the terminal to enter the car's Docker container:
xxxxxxxxxxdocker exec -it intelligent_sutherland /bin/bash
Press Enter to enter the Docker terminal. This is the terminal for the Docker container we initially launched. Subsequent program commands will need to be entered in this Docker container's terminal.
If you need to access the terminal after rebooting and the program you are running requires a graphical interface, enter the following command in the car's terminal:
xxxxxxxxxxxhost +
2.2 Entering a New Docker Container
- Ensure the existing Docker container is shut down and run the following command to start the new one.
xxxxxxxxxxsh ~/run_humble.sh
- Run the above command to enter the same container from multiple terminals.