X11 forwarding of a GUI app running in docker
Ok, here is the thing:
1) Log in to remote machine
2) Check which display was set with echo $DISPLAY
3) Run xauth list
4) Copy the line corresponding to your DISPLAY
5) Enter your docker container
6) xauth add <the line you copied>
*
7) Set DISPLAY with export DISPLAY=<ip-to-host>:<no-of-display>
*so far so good right?
This was nothing new...however here is the twist:
The line printed by xauth list
for the login user looks something like this (in my case):
<hostname-of-machine>/unix:<no-of-display> MIT-MAGIC-COOKIE-1 <some number here>
Because i use the bridged docker setup, the X forwarding port is not listening locally, because the sshd is not running in the container. Change the line above to:
<ip-of-host>:<no-of-display> MIT-MAGIC-COOKIE-1 <some number here>
In essence: Remove the /unix
part.
<ip-of-host>
is the IP address where the sshd is running.
Set the DISPLAY variable as above.
So the error was that the DISPLAY
name in the environment variable was not the "same" as the entry in the xauth list
/ .Xauthority
file and the client could therefor not authenticate properly.
I switched back to an untrusted X11 forwarding setting.
The X11UseLocalhost no
setting in the sshd_config file however is important, because the incomming connection will come from a "different" machine (the docker container).
Windows 10 Docker Host - Display GUI application from Linux Container
You'll need to set DISPLAY to something other than localhost
. The container has its own localhost interface, so your X11 client will attempt to connect to itself instead of to your host.
Instead, you can pass in an IP address of your windows machine's network adapter. The container will be able to connect to that. You'll also need to have your X11 server configured to listen on that interface.
Related Topics
Why Does The Linker Modify a -Defsym "Absolute Address"
Rtnetlink Answers: No Such File or Directory
Linux Script with Netcat Stops Working After X Hours
Reading from a File in Assembly
How to Disable Tcp Slow Start in Linux
Replace Forward Slash with Double Backslash Enclosed in Double Quotes
Amazon Linux Ami Ec2 Gui/Remote Desktop
Check If a Git Branch Is Ahead of Another Using a Script
How to Create a File Listener in Linux
Where Is Default Installation Directory for Mongodb
Poor Memcpy Performance in User Space for Mmap'Ed Physical Memory in Linux
How to Avoid Grub Errors After Running Apt-Get Upgrade - Ubuntu
How Does Copy-On-Write in Fork() Handle Multiple Fork
Gui Svn Client for Debian Linux
Elastic Beanstalk: Log Task Customization on Amazon Linux 2 Platforms
Setting Environment Variable with Leading Digit in Bash
.Htaccess Redirect Index.PHP to /
What Server-Side Web Technology Should I Use in an Embedded System