by Devin Yang

建立于: 7年前 ( 更新: 2年前 )

由於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

需要登入才可留言!

类似文章


docker,laravel,nfs

Docker在macOS上的NFS

D-laravel的nfs模式,在这篇文章您可以了解到,如何在macOS使用NFS+Docker。

openspeedtest,docker,phpenv

用phpenv跑openspeedtest

虽然我们可能会用speedtest之类网站进行上下传的速度的测试,那如果我们想测自己的Server的速度呢?像是用户在别的国家,连到我们的主机速度快慢 ,这时self-hosted的测试工具就很方便啦。最新版本的phpenv在services的yml档中,添加了openspeedtest.yml罗。

docker,git

用docker-compose快速创建私有的git服务

如何快速创建一个开箱即用的Gogs环境呢? 本文介绍采用docker-compose.yml快速创建gogs环境。