-
Notifications
You must be signed in to change notification settings - Fork 75
use observer
Note: for image size and many other considerations, the wx widgets dependencies are only built into the developer friendly version: the default series like
elixir:1.8
elixir:1.7
which are based on a full-featured debian based envrionment; do not expect observer to work in slim or alpine series.
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
<local>$ ssh -XY <remote>
<remote>$ 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 -X
enable X11 forwarding over ssh, runenv
from the X enabled remote shell you may notice the difference is it setsDISPLAY
to enable X programs running on remote host, but drawing over X Server, here theX Server
is 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;-Y
is trusted X11 forwarding - the
-v ~/.Xauthority:/root/.Xauthority
is needed to mount the Xauthority file as volume, so the X applications (the observer) can talk over the authorized X Server; the default run root in container is root, so mount it to /root/... but if you run with other uid/gid, mount into the other user's home directory can also work, but would need more complex permission granting. - the
-e DISPLAY=$DISPLAY
is to set DISPLAY as same as on the host - the
--network=host
is 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.0
over which sshd is listening on remote host only, X forwarding is not enabled into the further isolated container.