Skip to content

Executing GUI Apps in Containers

Russell T. Sherman edited this page Mar 16, 2017 · 9 revisions

This repo includes Apache Directory Studio, RoboMongo, and Valentina Studio in containers. To make these containers function properly you must install X11 server and enable X11Forwarding in your ssh config.

Linux Workstation

good news. you already have X11 installed.

edit /etc/ssh/ssh_config look for this line

#   ForwardX11 no

change it to this

ForwardX11 yes

add ip address to list of allowed remotes for xhost

xhost + $(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')

OSX Workstation

install xQuartz https://www.xquartz.org/

edit /etc/ssh/sshd_config look for this line

#X11Forwarding no

change it to this

X11Forwarding yes

add ip address to list of allowed remotes for xhost

xhost + $(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')

Windows Workstation

install xMing https://sourceforge.net/projects/xming/

(that's all i have for windows users right now)

DOCKER_DISPLAY ENV VAR

to allow GUI apps in containers to display properly they need to know the IP address of the host operating system.

on my mac workstation i use this code in my .zsh_profile so that the correct value is set any time i open a terminal.

export DOCKER_DISPLAY=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}'):0
xhost + $(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')

on my linux virtual machine it's a little trickier.

Containers running in the virtual machine still need to know the ip address of the host.

This code is executed in terminal before running any GUI container apps

export DOCKER_DISPLAY=XXX.XXX.XXX.XXX:0

this will have to do till i find a way to reliably allow the VM to know the host IP address.

Clone this wiki locally