-
Notifications
You must be signed in to change notification settings - Fork 135
Cross platform docker launch system and fix for GUI display issues on macOS with XQuartz for example 5 #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Fix macOS XQuartz display issues with dynamic DOCKER_DISPLAY variable - Add platform-specific setup instructions for macOS, Linux, Windows - Remove hard-coded IP addresses and display numbers - Add comprehensive troubleshooting for common X11 connection errors Resolves Docker GUI display issues on macOS and improves cross-platform compatibility.
…ty and X11 support
mcp_json.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed. It also contains your personal information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I have removed it
| xhost + | ||
|
|
||
| # Set DISPLAY for Docker (use your IP from Step 4 + display number) | ||
| export DOCKER_DISPLAY="10.1.56.72:1" # Replace with your actual IP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<YOUR_IP> instead of a random number
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has now been updated
|
|
||
| ```bash | ||
| docker compose up | ||
| ./launch.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused, the entire point of having docker compose up is that it doesn't need external configuration. I am not sure how I feel about having custom launch.sh floating around the repository, but I am no expert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand your concern @stex2005. However, the launch.sh script addresses host-side X11/GUI configuration, which is separate from the Docker container setup.
The problem:
On macOS (and some Linux systems), docker compose up alone isn't sufficient because:
- DISPLAY environment variable - Needs to be dynamically determined (varies by machine/network)
- XQuartz permissions - Requires
xhostauthorization before Docker can connect - XQuartz startup - Must be running and properly configured with "Allow connections from network clients"
- IP-based display - macOS requires
<IP>:<DISPLAY_PORT>
The script automates these host-side prerequisites before running docker compose up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how I feel about encapsulating multiple .sh files instead of the cleaner docker compose up.
Asking for input from others.
| stdin_open: true | ||
| tty: true | ||
| command: bash -c "/ros2_ws/scripts/launch_turtlesim.sh" | ||
| command: ["/bin/bash", "/ros2_ws/scripts/launch_turtlesim.sh"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has actually been removed, there should be a proper ros2 launch file instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scripts folder doesn't exist anymore, there is only a launch folder:
There is a template launch_rosbridge.launch.py, we can create inside 5_docker_turtlesim another simple launch file based on launch_rosbridge + the turtlesim node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, let me make that change. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you briefly explain what this does? Does it have to be run at each push? This is just an example: I would trigger it the on workflow_dispatch ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was using it for internal testing, I had removed it in a recent commit
|
@itsbharatj I think we could have kept the CI workflow in the example, but have it triggered only by |
|
Hey @stex2005, based on your comments, I have pushed the respective changes:
The struggle is that I want to test the turtelsim ui being displayed using the websocket on multiple OS. I am not sure how can I test it using GitHub CI. Also, please look at my reply for the using a singular Let me know your thoughts, Best |
|
Hey @stex2005, wanted to follow up and see if you’ve had a chance to go through the recent commits. Thanks, |
Overview
This PR addresses issue #101 and supersedes PR #153 for turtlesim Docker GUI testing.
Changes Made
1. Cross-Platform Launch System
launch.shmain script that automatically detects the host OSlaunch_macos.shfor macOS with XQuartz supportlaunch_linux.shfor native Linux X11 environmentslaunch_windows.shfor Windows using VcXsrv, X410 or other X servers2. macOS XQuartz Integration
hostname -Ifallback for IP resolution3. Documentation Improvements
README.mdwith platform-specific setup instructions4. Error Handling
Testing
Thoroughly tested on:
Resolves
Works on #101
Supersedes #153