通过VNC将Docker连接到X11失败

时间:2015-07-29 17:26:04

标签: docker x11 vnc

我有一台没有显示器的ubuntu服务器运行vncserver,我通过VNC访问它。

在此服务器上,我尝试从此博客运行chrome示例:https://blog.jessfraz.com/post/docker-containers-on-the-desktop/

但它失败了:

>./runChrome.sh 
Warning: '--cpuset' is deprecated, it will be replaced by '--cpuset-cpus' soon. See usage.
Unable to find image 'jess/chrome:latest' locally
latest: Pulling from jess/chrome
42b46c8b387a: Pull complete 
9402e656a0ac: Pull complete 
753b4bb947ba: Pull complete 
9f3ad4f52cb2: Pull complete 
c3374db106fe: Pull complete 
0cdf8bc021c3: Pull complete 
e1db72a1498b: Pull complete 
fe339b19b201: Pull complete 
7b966fb57da2: Already exists 
Digest: sha256:65185c906ab67ca126ca49943cc5c4f05d2e6c9aac04a505fa3f5e6b183b72da
Status: Downloaded newer image for jess/chrome:latest
WARNING: Your kernel does not support swap limit capabilities, memory limited without swap.
[1:1:0729/171614:ERROR:browser_main_loop.cc(185)] Running without the SUID sandbox! See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for more information on developing with the sandbox on.
No protocol specified
[1:1:0729/171614:ERROR:browser_main_loop.cc(231)] Gtk: cannot open display: unix:1
>cat runChrome.sh 
docker run -it --net host --cpuset 0 --memory 512mb -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -v $HOME/Downloads:/root/Downloads -v $HOME/.config/google-chrome/:/data --device /dev/snd --name chrome jess/chrome

知道如何解决这个问题吗?

可能出现什么问题?

1 个答案:

答案 0 :(得分:0)

这有效:

docker run -e DISPLAY -v $HOME/.Xauthority:/home/ghc/.Xauthority --net=host -ti 80d81a4ae162 /bin/bash

受到以下评论的启发:http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/