I have a docker container that opens a tkinter window but it keeps crashing because it can't connect to the display of the host machine. The answer given in this post suggest bind mounting the X-11 socket to container -v /tmp/.X11-unix:/tmp/.X11-unix:ro
and setting it's display environment variable to that of the host machine -e DISPLAY=$DISPLAY
but as these are both unix specific paths/variables they will not work on other operating systems. How can I pass the display information to the container so that tkinter can use it in a way that is host OS independent?
Asked
Active
Viewed 1,707 times
2

G Warner
- 1,309
- 1
- 15
- 27
1 Answers
1
You will not be able to get an X11-based docker container to display on a non-X11 display. If you want this docker container to be able to open windows to your display, you'll need to be running X11. There are server implementations for both Windows and OSX.

Bryan Oakley
- 370,779
- 53
- 539
- 685
-
So is there no way to get my docker container to display a window on any OS? If so, this seems like a giant limitation of docker technology... – G Warner Aug 02 '17 at 13:42
-
1@GWarner: it's not a limitation of docker technology, it's simply how computers work. There is no universal display protocol where a server can send information to any display on any OS. X11 does a great job of solving this in the *nix word -- any docker container can open windows on any other *nix system (which uses X11), but both windows and the mac use different display technologies. As I said in my answer, you can display windows on Windows and OSX if you install an X11 application. – Bryan Oakley Aug 02 '17 at 13:59