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, d-laravel, docker-compose, laravel

docker-compose loads multiple configuration files

We will use docker --network to establish multiple container interconnections, but if there are four containers, Is it necessary to issue docker run instructions for different containers four times, kill me, This article introduces the establishment of multiple containers at one time through the yaml file definition of docker-compose. Learn how to load multiple configuration files with the dokcer-compose -f parameter.  

docker,sqlserver

D-Laravel builds SQL Server environment

How to build D-Laravel's SQL Server environment

linux,raspberry

Install VNC Server on Raspberry Pi

Checklist introduces how to start VNC Server on Raspberry Pi