by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 1 year ago )

Because after the Mac OS Leopard version, Apple no longer builds X11 and requires everyone to use the open source XQuartz.
So if you want to display the X client screen on Mac OS, remember to install the Mac OS dedicated X11 server:
https://www.xquartz.org/index.html

First , before starting the MacOS environment, please remember to install XQuartz, and remember to tick the Enable network connection option

Here, let's take everyone to execute step by step
1. Authorize the Client

xhost + 127.0.0.1

TEST If you type xhost, you can see which clients are authorized. If you want to fully open, you can type xhost +

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

2. Here I use the Ubuntu image as an example, change the environment variables and enter bash

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

3. Install xeyes

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

Fourth, execute xeyes

xeyes

The result is as follows:


So, we can make a row

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

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


docker,laravel

It's super easy to build a Lravel development environment with Docker

Are you ready for the Laravel 5.5 system environment? laravel/framework 5.5.x-dev requires php >=7.0 -> your PHP version (5.6.30) does not satisfy that requirement. This article describes how to create a Laravel development environment using Docker. With the simple to explosive D-Laravel simple bash, Don't say that I can't set up a Laravel development environment.

cli,linux,macos

How to use find to delete old files based on the creation time

This function is very useful, but be very careful, read it first and then delete it, if you make a wrong directory, you will die miserably 

linux,system,config

Fix the problem that CentOS6.x can no longer be updated

There may still be some old programs in some places, which can only run the old system. But you want to be able to execute and install some desired packages, you may try this method. Please note that if this system is important to you, please evaluate it yourself. It is recommended that you have a Docker environment and have a backup image before trying it.