macos – 如何将Docker for Mac转发到X11?

使用Docker for Mac 1.12 (stable)和OS X 10.11.5(15F34),我试图将我的一个容器转发到X11.

首先,我从我的bash shell安装XQuartz:

$brew cask install xquartz

==> Downloading https://dl.bintray.com/xquartz/downloads/XQuartz-2.7.9.dmg
######################################################################## 100.0%
==> Verifying checksum for Cask xquartz
==> Running installer for xquartz; your password may be necessary.
==> Package installers may write to any location; options such as --appdir are ignored.
Password:
==> installer: Package name is XQuartz 2.7.9
==> installer: Installing at base path /
==> installer: The install was successful.
🍺  xquartz staged at '/usr/local/Caskroom/xquartz/2.7.9' (73M)

然后我继续设置XQuartz ……

open -a XQuartz

在XQuartz首选项中 – >安全选项卡,我启用“允许来自网络客户端的连接”.

然后我应该在我的bash shell中运行xhost $MY_IP_ADDRESS,但我得到的只是这个错误:

xhost:  unable to open display ""

最后,我正在阅读的所有指南都说我应该像这样运行我的容器:

docker run -e DISPLAY=$MY_IP_ADDRESS:0 -v /tmp/.X11-unix:/tmp/.X11-unix DOCKER_IMAGE

……但这不起作用.在我的特定容器中,我收到此错误:

... cannot connect to X server 10.0.0.131:0

我究竟做错了什么?

最佳答案
事实证明XQuartz 2.7.9中存在一个错误.

使用XQuartz 2.7.10_beta2时,它可以正常工作.

转载注明原文:macos – 如何将Docker for Mac转发到X11? - 代码日志