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

问题描述:

我有一个Dockerfile,它使我可以运行X应用程序。 它完全在Ubuntu的主机,但不是在的Archlinux主持人:无法在Docker容器中运行X应用程序,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窗口打开)的作品,但没有在我得到的拱门:

leafpad: Cannot open display: 

我需要很快得到这个工作。任何想法进一步调查将不胜感激。 PS:我有一个类似的Docker容器,它在Ubuntu容器中运行leafpad;问题对于那个容器也完全一样。 PPS:在Dockerfile从这里茎:[URL] http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/[/url]

+0

乱七八糟什么显示'泊坞窗EXEC -IT leafpad env',是显示定义? – user2915097 2015-03-02 14:29:30

+0

它的定义是: '$搬运工EXEC -IT A11 env' 节目(我不认为我可以在评论使用换行符...): 'PATH =在/ usr/local/sbin中:/ USR/local/bin中:/ usr/sbin目录:在/ usr/bin中:/ sbin目录:/ bin中 HOSTNAME = c2f7459e15d0 TERM = xterm的 DISPLAY =本地主机:0.0 XAUTHORITY =/TMP/.Xauthority中 HOME =/home/abla USER = abla' – mascip 2015-03-02 14:39:23

尝试使用

xhost的+

然后用xauth的东西