3
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ubuntu:20.04 dockerコンテナ内でホスト側にGUIを出力(xeyesを出力)する検討メモ

Last updated at Posted at 2020-11-23

xhostの設定、ubuntu:20.04 dockerコンテナ起動

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

xeyesをインストールして実行

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

ホスト側にxeyesを出力できた

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

追記、以下のnvidiaコンテナでもできた(nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04)

例1 nvidiaコンテナに変更

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

例2 例1+オプション追加

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

以下は、nvidiaコンテナ利用手順

参考
Docker(Ubuntu18.04+CUDA10.1+cudnn7)でOpenCV4.1.1インストールするメモ
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

以下は、runして内部のコマンドを実行する場合の参考(nvidia-smiを実行)

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

参考

Dockerコンテナの中でGUIアプリケーションを起動させる
Ubuntu on Docker on UbuntuでGUIを表示する方法

DockerコンテナのホストでGUIを起動する
Dockerを導入してGUI操作可能なLinux(Ubuntu)コンテナを作成する
dockerでGUIアプリ起動可能な環境構築 [クライアント <--> リモートサーバ <--> dockerコンテナ]
dockerでデスクトップ環境(GUI)を構築してみる。
DockerコンテナのホストでGUIを起動する

3
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?