Docker Community Forums

Share and learn in the Docker community.

Start X11 and others


(Satimis) #1

Docker on Ubuntu 16.04
Docker version 17.04.0-ce, build 89658b3

Hi all,

Please advise;

  1. How to start X11?
  2. How to install and run a GUI app
    I’m prepared to install Darktable which should run on desktop such as Ubuntu desktop etc.

Thanks in advance

Regards
satimis


(Sam) #2

you cannot run a gui app IN a container… you can run a gui app remotely on another host using the hosts display.

a container is supposed to be a server system with no UI. it is NOT a virtual machine


(Satimis) #3

Thanks for your advice.

I have following questions;

  1. Can I install Ubuntu 16.04 desktop on Docker?
  2. I installed xpra on Docker according to following document:
    Docker Desktop: Your Desktop over ssh running inside of a Docker container (20180131)
    https://blog.docker.com/2013/07/docker-desktop-your-desktop-over-ssh-running-inside-of-a-docker-container/

but I could start xpra, complaining X11 has been installed. I couldn’t resolve. I can’t start X11?

Please advise. Thanks

Regards
satimis


(Sam) #4

that post is almost 5 years old… docker has changed a lot since then…

you cannot install Ubuntu desktop in a docker container… this is NOT a virtual machine.
you can install SOME tools, but not a whole system.

u can start with the ubuntu 16.04 official container, but it has not graphical UI


(Satimis) #5

docker on Ubuntu 16.04 is running on as VM of VirtualBox

docker:
$ ifconfig


inet addr:192.168.8.59

Ran:
$ sudo apt install darktable
Installation went throught without complaint

On Host (Ubuntu 16.04 desktop) terminal run;
~⟫ ssh 192.168.8.59

The authenticity of host ‘192.168.8.59 (192.168.8.59)’ can’t be established.
ECDSA key fingerprint is SHA256:HjMkOuERIUkwdnqIg0/NU7Jk5M6pwRDEs+LZYAAzpb8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘192.168.8.59’ (ECDSA) to the list of known hosts.
satimis@192.168.8.59’s password:
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-112-generic x86_64)

0 packages can be updated.
0 updates are security updates.

Last login: Wed Jan 31 23:02:56 2018

$ which darktable

/usr/bin/darktable

$ darktable

[defaults] found a 64-bit system with 1016044 kb ram and 1 cores (0 atom based)
[defaults] setting very conservative defaults
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused

(darktable:3741): Gtk-WARNING **: cannot open display:

Please advise. Thanks

Regards
satimis


(Sam) #6

yes, you have to do all the remote display stuff to get an external xwindows window open… same as always… I don’t know how to do that myself… but a google search should give you the answers


(Satimis) #7

On Docker

Edit /etc/ssh/sshd_config
change:
ForwardX11 no
to:
ForwardX11 yes

Reboot Docker

On Host Terminal

Run;
$ ssh 192.168.8.59
$ export DISPLAY=:0
$ darktable

[defaults] found a 64-bit system with 1016044 kb ram and 1 cores (0 atom based)
[defaults] setting very conservative defaults
Failed to connect to Mir: Failed to connect to server socket: No such file or directory
Unable to init server: Could not connect: Connection refused

(darktable:2549): Gtk-WARNING **: cannot open display: :0

Still failed

satimis


(Sam) #8

do you have sshd running on the container? not there by default.


(Satimis) #9

Sorry I don’t follow?

On Dockert run;
$ apt-cache polich openssh-server

It is already there


(Sam) #10

well something is not running or there is a firewall issue…

i would docker exec into the container and verify the sshd is in fact running.,
and you can connect in text mode.


(Satimis) #11

Just found following article:-
If you run SSHD in your Docker containers, you’re doing it wrong!
Your containers should not run an SSH server
https://jpetazzo.github.io/2014/06/23/docker-ssh-considered-evil/

satimis


(Sam) #12

i agree, but you need to, to do the x remote…


(Stephen Steiner) #13

Actually, you don’t. You want a VM, not a container. I would use a VM and then push the developers to make a legit server that doesn’t need a local X server.


(Coreyhanson) #14

The best way I’ve found to use X11 on GUI apps with docker is by adding two arguments whenever starting the docker images.

-v /tmp/.X11-unix:/tmp/.X11-unix
-e DISPLAY=unix$DISPLAY

I’ve used for many apps, but expect to do more troubleshooting if the GUI requires the GPU. I did a quick test with the download of darktable from the ubuntu repository and it works great (the only issues that came up were a few missing dependencies from packagekit and libcanberra, which should be easy to find).


(Satimis) #15

Actually, you don’t. You want a VM, not a container. I would use a VM and then push the developers to make a legit server that doesn’t need a local X server.

I’m trying to test a virtualizer on another virtualizer. Any suggestion?

thanks


(Stephen Steiner) #16

Docker isn’t virtualization. VMware or libvirt maybe?