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

需要登入才可留言!

类似文章


openai,flax,docker

用容器跑OpenAI官方教程的Python(Flax)

如果您登录了openai的网站,可在此处看到官方的教程说明https://beta.openai.com/docs/quickstart/build-your-applicationAPI的KEY的申请,就在这页的下方就有按钮了+ Create new secret key本篇教您用Docker跑官方OpenAI运行环境。

docker,polymer,seo

用Rendertron解决Polymer SEO问题(Polymer Summit 2017)

文章下方的影片介绍如何使用rendertron解决Polymer SEO优化的问题。 在我fork的source中,已调整支持中文环境。 并且还添加了pdf的API接口,也可以拿来转pdf。

docker

ubuntu上安装docker-compose

简单介绍我如何在ubuntu上安装docker-compose. 还满容易的。