使用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 Preferences -> Security 选项卡中,我启用“允许来自网络客户端的连接”。
然后我应该xhost + $MY_IP_ADDRESS
在我的 bash shell 中运行,但我得到的只是这个错误:
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
我究竟做错了什么?