码头集装箱内:“错误:无法打开显示:本地主机:11.0”

问题描述:

我想通过ssh在码头集装箱中的图形界面使用程序。码头集装箱内:“错误:无法打开显示:本地主机:11.0”

目前我通过ssh连接到docker和容器运行的外部机器上。在主机上,我可以启动像firefox这样正确显示的程序。建立连接与:

ssh -Y [email protected] 

当我尝试在泊坞窗容器一样,与firefox图像(见下文):

docker run -it --privileged --rm \ 
    -e DISPLAY=$DISPLAY \ 
    -v /tmp/.X11-unix:/tmp/.X11-unix \ 
    -v /root/.Xauthority:/root/.Xauthority:rw \ 
    firefox 

我只是得到:

Error: cannot open display: localhost:11.0 

我已经尝试在主机上设置xhost +,但它仍然无法正常工作。 主机运行Scientific Linux release 7.2和泊坞窗图像与 Dockerfile从http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/创建:

FROM ubuntu:14.04 

RUN apt-get update && apt-get install -y firefox 

# Replace 1000 with your user/group id 
RUN export uid=1000 gid=1000 && \ 
    mkdir -p /home/developer && \ 
    echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd && \ 
    echo "developer:x:${uid}:" >> /etc/group && \ 
    echo "developer ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/developer && \ 
    chmod 0440 /etc/sudoers.d/developer && \ 
    chown ${uid}:${gid} -R /home/developer 

USER developer 
ENV HOME /home/developer 
CMD /usr/bin/firefox 

添加--net=hostdocker run解决了这个问题。