环境
- MacOS Sierra 10.12.6
- Docker版本17.09.0-CE,构建afdb6d4
- Ubuntu 16.04
- XQuartz 2.7.9
我想将Docker容器中的Chromium浏览器打开到我的Mac桌面上。
docker run -i -t ubuntu:16.04 /bin/bash
apt-get update
apt-get install alsa-base chromium-browser xauth
adduser myuser
承诺
docker commit 2862a7bfcc2f acme/mycontainer:0.1
myuser
从容器失败运行铬浏览器
docker run --user myuser -i -t acme/mycontainer:0.1 /usr/bin/chromium-browser
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
我敢打赌,还有更多
有指针吗?
UDPATE-使用 --privileged
消除错误,请参阅serverfault上的线程,但不会显示UI
docker run \
--privileged \
--user mysuer \
-i -t acme/mycontainer:0.1 /usr/bin/chromium-browser
还有这个
docker run \
--privileged \
--net host \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$DISPLAY \
-e XAUTHORITY=/.Xauthority \
-v ~/.Xauthority:/.Xauthority:ro \
--name chromium \
--user mysuser \
-i -t acme/mycontainer:0.1 /usr/bin/chromium-browser
铬未显示
更新20171011
docker run \
--privileged \
--net host \
-v /tmp/.X11-unix \
-e DISPLAY \
--name chromium \
--user myuser \
-i -t acme/mycontainer:0.1 \
bash
发生Chromium Gtk: cannot open display: [...] org.macosforge.xquartz:0
错误
$ chromium-browser --verbose
[37:37:1011/154632.348303:VERBOSE1:breakpad_linux.cc(1978)] Breakpad disabled
[1:1:1011/154632.378280:VERBOSE1:zygote_main_linux.cc(537)] ZygoteMain: initializing 0 fork delegates
[1:1:1011/154632.378653:INFO:cpu_info.cc(50)] Available number of cores: 4
[37:37:1011/154632.381303:WARNING:browser_main_loop.cc(275)] Gtk: cannot open display: \
/private/tmp/com.apple.launchd.Y2wR3QWw57/org.macosforge.xquartz:0
在我的Mac上编辑 sshd_config
sudo vim /etc/ssh/sshd_config
X11Forwarding yes
X11DisplayOffset 10
XAuthLocation /opt/X11/bin/xauth
在我的Mac上 DISPLAY
$ env | grep DISPLAY
DISPLAY=/private/tmp/com.apple.launchd.Y2wR3QWw57/org.macosforge.xquartz:0
在磁盘上
ls -al /private/tmp/com.apple.launchd.gCYQToI4lb/*
srw-rw-rw- 1 joel wheel 0B Oct 11 17:50
/private/tmp/com.apple.launchd.gCYQToI4lb/org.macosforge.xquartz:0=
1
@zabumba,您有什么用吗?
—
达米安·鲍威尔