Cogs and Levers A blog full of technical stuff

Can't connect to X11 window server when using docker

On some host system configurations, I’ve found that Docker containers that use the host’s X11 session to present a user interface, terminate with a dreaded:

Can't connect to X11 window server using 'unix:0.0' as the value of the DISPLAY variable

Seems that on these systems, access needs to be granted to users making connections to the X11 host. This is done using the xhost command, like so.

$ sudo xhost +

Your docker containers shouldn’t have any issues now.