<?xml version="1.0" encoding="ISO-8859-15"?>
<rss version="2.0"><channel>
<title>running graphical programs from docker containers</title>
<link>http://sange.fi/~atehwa/cgi-bin/piki.cgi/</link>
<description>Recent changes in running graphical programs from docker containers</description>
<item><title>running graphical programs from docker containers</title>
<link>http://sange.fi/~atehwa/cgi-bin/piki.cgi/running%20graphical%20programs%20from%20docker%20containers</link>
<guid>http://sange.fi/~atehwa/cgi-bin/piki.cgi/#1476439178</guid>
<description>&lt;p&gt;&lt;ins&gt;(nettipäiväkirja 14.10.2016) SoapUI is one of those softwares I 
'''don't''' want to install on my computer directly. (The tar 
installation is not as bad as the install script, but I don't like 
non-packaged software in general.) So one of the options is to run it 
from a Docker container instead.&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;However, it's a graphical program, so I need some way for it to 
contact my X server. SSH tunnelling is an option, but most Docker Hub 
images don't come with a running SSH daemon so I can't contact them by 
SSH. This is in accordance to the Docker philosophy where at optimum 
there is a single program running in every container.&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;An easier option is to mount the X11 Unix domain sockets to the 
container, because that's what X11 uses for local connections nowadays 
anyway. This is a lightweight version of the ideas in 
http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/&lt;/ins&gt;
 

&lt;p&gt;&lt;ins&gt;So we run the docker container like this:&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;{{{ docker run -it --rm -e DISPLAY=$DISPLAY -v 
/tmp/.X11-unix:/tmp/.X11-unix \ ruimo/df-ub1404-soapui521 }}}&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;Inside the docker container, we need some setup, because it's 
not designed to be used like this. In the bash that we get, we create a 
user to connect to the X11 socket with the right uid (= our uid on the 
host) and start SoapUI as that user. In the following command, write 
your UID on the host instead of 1000 in the command; if you don't know 
what it is, run the command "id" on your host:&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;{{{ root@1a60bee63647:/# useradd -u 1000 -g 0 someuser 
root@1a60bee63647:/# sudo -u someuser /opt/SoapUI-5.2.1/bin/soapui.sh &amp; 
}}}&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;Ta-da! We get a SoapUI window on the X11 server we are 
using.&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;Another thing. You might need to contact your host machine from 
the SoapUI container -- for example if your SOAP service is running on 
the localhost. This is possible, if the processes you run on your host 
bind to all interfaces (0.0.0.0) and not just localhost (127.0.0.1). To 
find out the IP address you can use for contacting the host from the 
container, run this in the container:&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;{{{ root@1a60bee63647:/# /sbin/route -n | awk '$1 ~ "0.0.0.0" { 
print $2; }' 172.17.0.1 }}}&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;So, to contact my host process that listens to say port 8888, 
I'll have to contact http://172.17.0.1:8888/.&lt;/ins&gt; 

&lt;p&gt;&lt;ins&gt;* [merkintä: 2016-10] * [atehwa] * [kategoria: 
päiväkirjamerkintä] * [how to run a virtual server style docker 
container with access to host docker] * [handy command line client for 
tds databases] * [kategoria: työkalut]&lt;/ins&gt;

</description>
<pubDate>Fri, 14 Oct 2016 09:59:38 +0000</pubDate>
</item>

</channel></rss>
