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

需要登入才可留言!

类似文章


docker,dlaravel

D-Laravel 1.5.5变更说明

D-Laravel的fpm image在php 7.2.1以前是使用docker php官方的dockerfile重build的, 并且所以我可以指定了fpm的默认的owner是dlaravel, --with-fpm-user=USER Set the user for php-fpm to run as. (default: nobody) --with-fpm-group=GRP Set the group for php-fpm to run as.

linux

如何安装monitor工具htop到CentOS上

Htop是一个基於Linux的免费(GPL)基於ncurses的进程monitor工具。 他类似於top,但允许您垂直和水平滚动,所以您可以看到运行在系统完整的命令行, 以及可将它们视为进程树,选择多个进程并进行操作。

linux

加载.env的环境变量到系统上

加载.env的环境变量到系统上