Windows 10 Docker & GUI

Recently, whilst working with YOLO on Docker I received the following message:

Gtk_WARNING **: cannot open display:

To resolve this, I turned to Xming X Server, an X11 display server for Microsoft Windows.  Once installed, simply add your ip address to the c:\Program Files (x86)\Xming\x0.hosts file eg:


Then run Xming.  It'll sit in the System Tray and say "Xming Server:0.0"

Then from within PowerShell or VS Code Terminal set a DISPLAY environmental variable to your ip address eg:

 PS> set-variable -name DISPLAY -value

Then run your docker container:

 PS> docker run -it --privileged -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix daltskin/darknet bash

If you don't have a docker image to test this on, you can try it with Firefox eg:

 FROM ubuntu:16.04
RUN apt-get update && apt-get install -y firefox
CMD /usr/bin/firefox

Then run the following commands (changing the ip address obvs)

 PS> set-variable -name DISPLAY -value
PS> docker build firefox
PS> docker run -it --privileged -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix firefox

Then wait for the UI magic :)