-
Notifications
You must be signed in to change notification settings - Fork 79
use observer
since erlang:19.2 images the tk libraries dependencies were added, hence running observer from the container is now possible; elixir:1.4 is based on erlang19 images and released after erlang:19.2, so it has the same ability to run any erlang / elixir tk based apps, the most prominent one is the Erlang observer
while it depends which client X window is used, the actual way of how it works might be different:
mount bind the ~/.Xauthority, like docker run -it --rm -v ~/.Xauthority:/root/.Xauthority elixir
in many cases, if the localhost is not running Linux (like the Mac / Windows), the docker engine is running on remote Linux server (could be really remote, or in a virtual machine), need ssh with X forwarding, mount binding the ~/.Xauthority, and set proper DISPLAY, and docker run with --network=host
$ docker run -it --rm -v ~/.Xauthority:/root/.Xauthority -e DISPLAY=$DISPLAY --network host elixir
Erlang/OTP 19 [erts-8.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.4.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> :observer.start
explanations why all these are needed:
-
ssh -Xenable X11 forwarding over ssh, runenvfrom the X enabled remote shell you may notice the difference is it setsDISPLAYto enable X programs running on remote host, but drawing over X Server, here theX Serveris usually on localhost, so usually you may seeDISPLAY=localhost:11.0; the X protocol is the number 11 + base offset 6000, so sshd is listening on tcp port 6011 of 127.0.0.1 - the
-v ~/.Xauthority:/root/.Xauthorityis needed to mount the Xauthority file as volume, so the X applications (the observer) can talk over the authorized X Server - the
-e DISPLAY=$DISPLAYis to set DISPLAY as same as on the host - the
--network=hostis also needed here, it let the container use same network as the remote host, because otherwise docker engine will set up a veth pairs and move one into the isolated container, then it becomes unable to talk tolocalhost:11.0over which sshd is listening on remote host only, X forwarding is not enabled into the further isolated container.