ubuntu: 20.04 Consideration memo to output GUI (output xeyes) to host side in docker container

xhost settings, ubuntu: 20.04 docker container start

xhost local:
docker run -it -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix ubuntu:20.04

Install and run xeyes

apt-get update -y; apt-get install -y x11-apps;

I was able to output xeyes to the host side

Screenshot from 2020-11-23 11-37-10.png

Added, it was also possible with the following nvidia container (nvidia / cuda: 10.1-cudnn7-devel-ubuntu18.04)

Example 1 Change to nvidia container

xhost local:
docker run -it -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04

Example 2 Example 1 + option added

xhost local:
docker run -it -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix --gpus 1 nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04

The following is the procedure for using the nvidia container

Reference Notes on installing OpenCV4.1.1 with Docker (Ubuntu18.04 + CUDA10.1 + cudnn7) Installation (Native GPU Support)

sudo apt install curl
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey |   sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list |   sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt update
sudo apt-get install -y nvidia-container-toolkit

The following is a reference when running and executing internal commands (execute nvidia-smi)

docker run --gpus 1 nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 nvidia-smi

reference

[Launch GUI application in Docker container](https://unskilled.site/docker%E3%82%B3%E3%83%B3%E3%83%86%E3%83%8A%E3%81 % AE% E4% B8% AD% E3% 81% A7gui% E3% 82% A2% E3% 83% 97% E3% 83% AA% E3% 82% B1% E3% 83% BC% E3% 82% B7 % E3% 83% A7% E3% 83% B3% E3% 82% 92% E8% B5% B7% E5% 8B% 95% E3% 81% 95% E3% 81% 9B% E3% 82% 8B / How to display GUI on Ubuntu on Docker on Ubuntu

Launch GUI on Docker container host Install Docker to create a GUI-operable Linux (Ubuntu) container Building an environment where GUI applications can be started with docker [Client <-> Remote server <-> docker container] Try building a desktop environment (GUI) with docker. Launch GUI on Docker container host

Recommended Posts

ubuntu: 20.04 Consideration memo to output GUI (output xeyes) to host side in docker container
Command memo to install xeyes in ubuntu docker environment
(Memo) How to solve dummy output in Ubuntu 20.04
[Docker] Copy files from docker container to host
How to check the logs in the Docker container
Copy files from docker container to host (docker cp)
How to update pre-built files in docker container
Display ROS application on Docker with GUI on host side
When there is no output to stdout in docker log
Host specification when laravel php artisan serve in docker container
[Docker] How to access the host from inside the container. http://host.docker.internal:
Ubuntu unable to log in