无法在Archlinux主机中的Docker容器中运行X应用程序

我有一个Dockerfile,使我能够运行X应用程序。 它在Ubuntu主机中完美工作,但不在Archlinux主机中:

FROM mascip/archlinux:2014.12.09 # To avoid a bug with the filesystem: https://registry.hub.docker.com/u/base/arch/ RUN sed 's/^CheckSpace/#CheckSpace/g' -i /etc/pacman.conf # BROWSERS RUN pacman --noconfirm -S nvidia-libgl && pacman --noconfirm -S leafpad # NON-ROOT USER # Replace you uid, gid, and username RUN pacman --noconfirm -S sudo RUN export uid=1000 gid=1000 && the_user="abla" && \ the_home="/home/${the_user}" && \ the_capital_user=$(echo $the_user | sed 's/./\U&/') && \ mkdir -p $the_home && \ echo "${the_user}:x:${uid}:${gid}:${the_capital_user},,,:/${the_home}:/bin/bash" >> /etc/passwd && \ echo "${the_user}:x:${uid}:" >> /etc/group && \ echo "${the_user} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${the_user} && \ chmod 0440 /etc/sudoers.d/${the_user} && \ chown ${the_user}:${the_user} -R ${the_home} # Replace username and home ENV USER abla ENV HOME /home/abla WORKDIR /home/abla USER abla CMD /usr/bin/leafpad 

为了运行它,我这样做:

 $ docker build -t a1 . $ docker run -ti \ -e DISPLAY -e XAUTHORITY=/tmp/.Xauthority -v /home/user/.Xauthority:/tmp/.Xauthority -v /tmp/.X11-unix:/tmp/.X11-unix \ a1 leafpad 

这在Ubuntu中可用(一个Leafpad窗口打开),但不是在我得到的Arch中:

 leafpad: Cannot open display: 

我需要很快得到这个工作。 任何想法进一步调查将不胜感激。

PS:我有一个类似的Docker容器,它在Ubuntu容器中运行leafpad; 那个容器的问题也完全一样。 PPS:Dockerfile源于此:[url] http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/[/url]

尝试使用

xhost +

然后弄乱xauth的东西