1

Here's my steps..

Installing Socat and XQuartz

brew install socat
brew cask install xquartz

Opening XQuartz setting Socat Listener

open -a XQuartz
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"

Running Docker container with DISPLAY environmental variable

docker run -e DISPLAY=192.168.0.13:0 tkinter sh

Here's the error I'm receiving.

// Container

_tkinter.TclError: couldn't connect to display "192.168.0.13:0"

// Socat

socat[37688] E connect(8, LEN=2 AF=1 "", 2): Invalid argument

Any other IP address gives me a similar error but doesn't show up in Socat so I can assume my IP is correct.

Any suggestion would be appreciated.

4

1 回答 1

1

您是否尝试在 docker 中运行 GUI 应用程序?你见过这种方法吗?

打开 Xquartz 后,您必须允许来自网络客户端的连接。我知道在 linux 上你必须共享你的 .x11 卷并启用 xhost,看起来在 mac 上你必须这样做:

ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
xhost + $ip
docker run -d --name displayContainer -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix <yourRepo>/<yourImage>
于 2017-08-20T05:20:03.413 回答