-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
how to use -e DISPLAY flag on osx? #8710
Comments
So since boot2docker is running docker in a virtualbox, there are going to be a few extra configurations that need to happen... |
Yeah so I think VNC is your best option here... you could ssh into the box and enable X11 forwarding as seen here http://oroborosx.sourceforge.net/remotex.html |
Oh c'mon - where's your sense of adventure? Surely something magical could be done with |
I mean I am still going to try and find a solution in my freetime for fun ;) , but just to clear up it will be more of a hack than a fully supported docker feature :) |
Hahaha, even the Linux version is truly a hack (but a really cool one). |
thats what makes it sooooo cool |
Yeah, I haven't been able to get ssh -X (or -Y) to work on boot2docker at all. |
now that would actually be straight up magic On Fri, Oct 24, 2014 at 5:19 AM, Brian Goff [email protected]
|
A somewhat crude way to do this: Start socat to expose local xquartz socket on a TCP port
Pass the display to container (assuming virtualbox host is available on 192.168.59.3):
(This is insecure on public networks, add |
Wow @slobo
|
Oh, that's really cool! |
In case anyone else is trying, these are my steps to get @slobo's method to work brew install socat
brew cask install xquartz
open -a XQuartz
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
# in another window
docker run -e DISPLAY=192.168.59.3:0 jess/geary |
It's awesome. Thanks, @slobo |
Note that the $DISPLAY variable is set in the XQuartz shell. In my case, the value was /private/tmp/com.apple.launchd.HxHsgt3DEr/org.macosforge.xquartz:0 |
@Krijger did you run the Unless your installation is special, |
@slobo yes, I ran the socat command. Only, I ran that in a shell where DISPLAY was not set, thus socat did not forward to the XQuartz socket. The shell inside of X11 does have this variable. After realizing this I changed my question to you in a statement, but you probably replied directly from email and did not see that. Sorry for that. |
Ah, makes sense. Cheers. |
Note that the ip for the display is not $(boot2docker ip), but the address of the vboxnet0 that you can find in ifconfig
|
@slobo (geary:1): Gtk-WARNING **: cannot open display: 192.168.59.3:0 |
And on the socat screen, |
It would seem that xquartz socket does not exist. Try starting xquartz
manually and running the socat command from xterm that pops up.
|
Does "echo $DISPLAY" give you ":0" per chance? What if you try it in
Terminal.app, do you get something that looks like file system path? If
so, then try running socat from there.
What we are trying to do is get socat to proxy traffic between TCP port and
X11 unix socket, so we have to figure out the path to that socket on your
system. On Linux it's often /tmp/.X11-unix/X0, but apple does some funky
stuff with launch daemon to present a socket even when you don't have X11
installed so that they can inform you of missing XQuartz.
|
Yes, In Xterm it does gave me ":0". In terminal app $DISPLAY=0.0, No file Yes, In my linux system it did work out with direct docker command just by Thanks Best On Sun, Mar 1, 2015 at 3:03 PM, Slobodan Mišković [email protected]
|
Try quitting xquartz and terminal.app, and then starting terminal.app again On March 1, 2015 3:35:16 PM Arihant Patawari [email protected] wrote:
|
It remains the same $DISPLAY=0.0 |
This discussion was SUPER useful! After In the xterm shell, I do this:
And I have the |
The magic for me was the above, swap en4 for en13. ifconfig and try one of the ones that thas 'inet ' that is a space, not a number. Then i changed :1 to :0 and voila!
|
I've found using First, run XQuartz and open the pref pane. On the Security tab, make sure Now from a mac terminal, run: open -a XQuartz
xhost + $(hostname) # this must be called after starting xquartz
docker run --rm -it -e DISPLAY=$(hostname):0 openmicroscopy/octave \
--eval "graphics_toolkit gnuplot;plot(rand(10));pause" # this is just an example to show X11 working If the above doesn't work, try this instead: IFACE=en4 # change this to whatever your active interface is
IP=$(ifconfig $IFACE | grep inet | awk '$1=="inet" {print $2}')
xhost + $IP # The '+' is important!
# now run docker as above, substitute `-e DISPLAY=$IP:0` |
Note that, if you have trouble finding the correct IP, |
@jay-hankins I tried both |
@thom-nic Sorry, should have clarified; I use the socat method, not the xhost method. I tried a few different things but xhost never seemed to work. So, here's what works for me on mac OS High Sierra 10.13.3:
As I said, |
Hey Guys, Is there still momentum on this? I realize this thread is nearly 4 years old. But, I can also see extremely valid use cases of serving UIs from containers as does everyone else here. I'm doing all of the above with Docker 18.0.3, a recent socat version, XQuartz 2.7.11 and OSX 10.13.3. I've tried @jessfraz's chrome, firefox, slack, etc, etc and all of them are basically unusable. Piergiorgio Niero's demo of getting GPU support into the container is a pretty cool read: Seems to get GLXGears going much faster on the GL side. It's obviously super impressive that he's running Blender in a container. I'm guessing I'm not going to be getting a fantastic render of Gangnam Style Doom - (credit Playcanvas guys - you're AWESOME): Am I just an idiot? Don't answer that! 😀 Should I try the xhost route instead? Are we seeing similar results on Windows with Windows containers? Thanks for any advice. Steven |
I've tried slack but it's way too slow for me too :( |
Too bad. I see alot of use cases to be able to run GUIs in containers. Odd to think of how something could be slow that is streaming from one place to another on the same computer. Would that be an X11 problem or a Docker problem? Has anyone tried VNC on local from container to host? Obviously, it would have lag if those were apart. But, does it if they're on the same box? Steven |
I've tried the |
Great! docker run -it -e DISPLAY=docker.for.mac.localhost:0 -v /tmp/.X11-unix:/tmp/.X11-unix --rm dresantos/pac pac |
@rocwenlinux - can you let us know how performance goes there? Everyone else is experiencing dial like performance when mirroring X11 everywhere else. |
@tateman74 I just follow the steps summarised by saulshanabrook, the only change is host ip address because of macos. i use docker.for.mac.localhost brew install socat socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:"$DISPLAY" in another windowdocker run -it -e DISPLAY=docker.for.mac.localhost:0 -v /tmp/.X11-unix:/tmp/.X11-unix --rm dresantos/pac pac My macbook info: |
Oh I see. You're just mirroring a terminal then? No real GUI applications which is kind of what the thread is all about right? |
Probably. I am not sure how PAC implement the GUI (perl+GTK?), but its main function is to provide ssh terminal and manage ssh connections, not complex. It isn't a heavy-GUI application. |
I also gave this a try with the X11 socket approach and it is way too slow. Mostly unusable 😞 |
Having this problem over and over and finally found the solution:
What I noticed was that XQuartz is opened again
And I just closed it manually after running the app... TOR
Eclipse
|
@jay-hankins You saved my day. Was trying to open ns2 for like 1 week. Thanks. |
@marcellodesales thanks for your help, I did all the steps but still getting the error: ip-192-168-1-52:~ loretoparisi$ lsof -i TCP:6000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
X11.bin 1266 loretoparisi 11u IPv6 0x511017374ef40ddb 0t0 TCP *:6000 (LISTEN)
socat 1601 loretoparisi 5u IPv4 0x511017373c28c09b 0t0 TCP *:6000 (LISTEN) docker started as docker run -e DISPLAY=docker.for.mac.host.internal:0 --rm -it -v $(pwd):/app facemaskdetect bash but I'm getting a connection refused from socat:
while the error within docker / open-cv was
I have XQuartz up and running. |
my mac complains that it cannot find /dev/snd |
@loretoparisi in newer Docker for Mac releases the hostname is @s0rav what containers are you running? The |
@dragon788 thank you! Infact, now I get a different error docker run -e DISPLAY=host.docker.internal:0 --rm -it -v $(pwd):/app facemaskdetect bash
$ python facemaskdetect/detector.py -i examples/example_01.png -o cam
[INFO] computing face detections...
No protocol specified
: cannot connect to X server host.docker.internal:0 while if I go for docker run -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --rm -it -v $(pwd):/app facemaskdetect bash
$ python facemaskdetect/detector.py -i examples/example_01.png -o cam
[INFO] computing face detections...
: cannot connect to X server /private/tmp/com.apple.launchd.qIcIi1ayqO/org.macosforge.xquartz:0 [UPDATE] export IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
xhost +$IP
xhost +local:docker
docker run --rm -it -e DISPLAY=$IP:0 -e XAUTHORITY=/.Xauthority --net host -v /tmp/.X11-unix:/tmp/.X11-unix -v ~/.Xauthority:/.Xauthority -v $(pwd):/app facemaskdetect bash
$ python facemaskdetect/detector.py -i examples/example_01.png -o cam
[INFO] computing face detections...
: cannot connect to X server :0 Thank you! |
In my /dev/ directory, /snd/ is not present. |
I am running boot2docker on OSX 10.10
I have a simple docker image, the dockerfile is:
I know that one can use VNC (method: install VNC in image, forward ports, access using VNC on osx etc) and I do not want to use VNC if it's possible to load the GUI application in the container to the host's display using the
-e DISPLAY
flag. I randocker run -ti --rm -e DISPLAY -v /tmp/.X11-unix/tmp/.X11-unix arch/firefox
and got:Any help is appreciated! Thanks
The text was updated successfully, but these errors were encountered: