README_GUI.md
April 16, 2025 ยท View on GitHub
GUI applications in remote containers are a bit of a pain in the neck. Which makes GUI applications in remote VSCode devcontainers are even more of a pain.
GUI applications in remote Docker containers
If you want to launch a GUI application from a remote docker container, as for example during mapping, a couple of specific steps need to be taken.
Using your fancy bashrc alias
If you built your container, you should have an alias dsshcar in your bashrc from here, which allows you to SSH into the car and the car's running forzaeth_devcontainer with the correct environment variables set.
dsshcar <your_username_on_the_car>@<car_ip>
Thats it. Now you can run any GUI application from the container, and it will be displayed on your local machine. Try it out with xeyes which is a simple GUI application that displays a pair of eyes that follow your mouse cursor.
[DEPRECATED] GUI applications in remote Docker containers
- Connect to a car via SSH, enabling X forwarding with the
-Xflag:
ssh -X <username>@<car_ip>
- Move to the ForzaETH race stack directory, and run the
xauth_setup.shscript:
cd <racestack_directory>
source .devcontainer/.install_utils/xauth_setup.sh
You should get at least the first line of the following output:
non-network local connections being added to access control list
xhost: must be on local machine to add or remove hosts.
- run the container with the appropriate script. If had you never run the container, running
main_dock.shshould be fine, otherwise consider attaching to the already built container withmain_attach_dock.sh.
.docker_utils/main_dock.sh
- Enjoy a terminal with GUI forwarding!
GUI applications in remote VSCode devcontainers
Due to the complicatedness of how a VSCode container is spun up, connecting to GUI applications requires a bit more involvement and a secondary SSH connection, to which we can relay the X forwarding. Due to this reason, both a terminal and VSCode need to be opened in the car.
- Connect to a car via SSH, enabling X forwarding with the
-Xflag:
ssh -X <username>@<car_ip>
- Move to the ForzaETH race stack directory, and run the
xauth_setup.shscript:
cd <racestack_directory>
source .devcontainer/.install_utils/xauth_setup.sh
You should get at least the first line of the following output:
non-network local connections being added to access control list
xhost: must be on local machine to add or remove hosts.
- Mmeorize the
DISPLAYnumber in this SSH-connected terminal, afeter printing it to screen:
echo $DISPLAY
an example output could be
localhost:10.0
-
open up the devcontainer on the car, first by opening up VSCode, then connecting to the car with the remote connection button to the bottom left (Connect to Host...), then open the race stack folder, and reopen in the devcontainer.
-
In the devcontainer terminal where you want to use the GUI application, export now the
DISPLAYvariable number. For example:
export DISPLAY=:10.0
- Enjoy a terminal with GUI forwarding!