by Devin Yang

建立于: 8年前 ( 更新: 3年前 )

由於Mac OS Leopard版之后,Apple已不在内建X11,要求大家使用open source的XQuartz,
所以如果您想在Mac OS上,显示X client的画面,记得先安装Mac OS专用的X11 server:
https://www.xquartz.org/index.html

首先,在MacOS环境开始前,请记得安装XQuartz,并且记得启动允许网络连线要打勾哦

这里,先带大家一步一步运行
一、授权可连线的Client

xhost + 127.0.0.1

如果您打xhost可以看到有那些clients被授权,如果想完全开放可以打xhost +

xhost +
access control disabled, clients can connect from any host

二、在这里我使用Ubuntu的image为例,变定环境变量并且进入bash

X=/tmp/.X11-unix && \
docker run --rm  \
-v $X:$X -e DISPLAY=host.docker.internal:0 \
-ti ubuntu bash

三、安装xeyes

apt-get update&&apt-get -y install x11-apps&&xeyes

四、运行xeyes

xeyes

结果如下:


所以,我们可以弄成一行

X=/tmp/.X11-unix && \
docker run --rm  \
-v $X:$X -e DISPLAY=host.docker.internal:0 \
-ti ubuntu sh -c 'apt-get update&&apt-get -y install x11-apps&&xeyes'

 

 


 

Tags: linux docker

Devin Yang

文章内容无法一一说明,如果您有什么不了解处,欢印提问哦:)

No Comment

Post your comment

需要登入才可留言!

类似文章


linux,system,config

修正CentOS6.x无法再更新的问题

有些地方或许还存在一些老旧进程,只能跑旧的系统。但又希望能运行及安装一些想要的包,您或许可以试这招请注意,如果这个系统对您很重要,请自行评估,建议您是Docker环境,并且有备份了image才可尝试。

linux

移除Ubuntu上旧版本用不到的Linux Kernel

这个页面描述我如何移掉 ubuntu上占空间的旧版本Linux Kernel。

linux

haproxy 1.8.9编译日志

日志在Ubuntu下编译haproxy 1.8.9过程。