cannot connect to X server in a Docker container

11,120 views
Skip to first unread message

Amir Szitenberg

unread,
Oct 22, 2014, 7:21:30 AM10/22/14
to eteto...@googlegroups.com
Hi 

I am rewriting this question, sorry for any double posting:

I am using ETE  with ipython notebook in a docker container. It works nicely, however when I try to render I get `cannot connect to X server`. I have tried setting the container's DISPLAY variable to local_host:0.0 and also to local_host:8888. The latter is the port to which I serve ipython notebook. For each DISPLAY setting I have used `xhost +local:root` in the container. These steps to not solve the issue for me. 

If anyone has experience with running ETE in a docker container in general or with this specific issue, I'll appreciate any ideas.

Thanks

Amir

Jaime Huerta Cepas

unread,
Oct 22, 2014, 7:57:22 AM10/22/14
to eteto...@googlegroups.com
Hi Amir, 

the Docker container should be aware of your local DISPLAY and your X session. In other virtualization environments, this is easily solved through X forwarding, but in Docker there should be a more direct way consisting of exporting your DISPLAY variable and mounting your local Xsession, Xauthority files within the docker subsystem when you start it. 

Something like what it is described here to get X access for a docker R environment: http://stackoverflow.com/a/25334301/255832

let us know if you get it working... it is a pretty interesting setup :)

cheers,
Jaime

================================================
Jaime Huerta-Cepas, Ph.D.
Structural and Computational Biology Unit
EMBL Heidelberg
Meyerhofstraße 1, 69117 Heidelberg, Germany
http://www.bork.embl.de/~huerta/
================================================

--
You received this message because you are subscribed to the Google Groups "The ETE toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to etetoolkit+...@googlegroups.com.
To post to this group, send email to eteto...@googlegroups.com.
Visit this group at http://groups.google.com/group/etetoolkit.
For more options, visit https://groups.google.com/d/optout.

Amir Szitenberg

unread,
Oct 24, 2014, 8:04:01 PM10/24/14
to eteto...@googlegroups.com
Thank you Jaime, that hit the spot. I summarize the steps I adopted from this excellent post:

1. In the docker run command line include -v /tmp/.X11-unix:/tmp/.X11-unix:ro to couple the working directories of the x server in the container and in the OS.
2. In the docker run command line include -e DISPLAY=$DISPLAY to set the container's DISPLAY env var to the same value as the OS.
3. In the OS do xhost +local:root to allow the container access to the OS's x-server.

See important comments in the post (http://stackoverflow.com/a/25334301/255832) about security while working in a server or on a machine with multiple users. You will then need to set the container to run as a user (not as root) and set xhost to allow access only to that user.

Thanks again,

Amir

--
You received this message because you are subscribed to a topic in the Google Groups "The ETE toolkit" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/etetoolkit/4SrZk5fRtCM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to etetoolkit+...@googlegroups.com.

vic...@explore-datascience.net

unread,
Aug 6, 2018, 7:29:24 AM8/6/18
to The ETE toolkit
Minior change on @Amir Szitenberg's solution:

I had to do the following for the seconde step '-e DISPLAY=unix$DISPLAY'.

Hope this helps those who are still having issues.

aaron...@hotmail.com

unread,
Jun 24, 2019, 11:35:46 AM6/24/19
to The ETE toolkit
Hello, I am having troubles.

Could you let me know the exact command line that I should input for @Amir Szitenberg's steps?

Jaime Huerta Cepas

unread,
Jun 28, 2019, 3:04:52 AM6/28/19
to eteto...@googlegroups.com
it depends on each computer. usually 
export DISPLAY=:0

you can also try 'xvfb-run python my_server_script.py' which is probably the most convenient way

--
You received this message because you are subscribed to the Google Groups "The ETE toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to etetoolkit+...@googlegroups.com.
To post to this group, send email to eteto...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages