LoginSignup
2
1

More than 1 year has passed since last update.

DockerでOpen3DのGUIを使えるようにする

Last updated at Posted at 2022-11-28

Open3D ViewerなどのGUIアプリケーションの使い方は参考文献に詳しく載っているので、この記事では簡単にまとめる。

環境

  • Ubuntu: 20.04
  • Open3D: 0.16.0
  • Docker: 20.10.21
  • Docker Compose: 2.4.1

設定方法

1. Xサーバへのアクセスを許可

下記コマンドでXサーバへのアクセスを許可する。また、Xサーバの現在の設定の確認はxhost、ローカルホストの削除はxhost -local:でできる。

xhost +local:

2. Open3D Viewer Dockerの設定

docker runに以下のオプションをそれぞれの場合に応じて追加する。

  • GPU:
    • Intel (Mesa drivers): --device=/dev/dri:/dev/dri
    • NVIDIA: --gpus 'all,"capabilities=compute,utility,graphics"'
    • No GPU (CPU rendering): --env OPEN3D_CPU_RENDERING=true
  • X server:
    -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY

例えば、NVIDIA GPUを使用する場合は、以下の通り。

docker run  --gpus 'all,"capabilities=compute,utility,graphics"' \
-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY \
open3d-viewer:latest

docker runでオプションを付けるのは少々煩雑なので、docker-compose.ymlにまとめる。下の設定はNVIDIA GPUを使用する場合。

docker-compose.yml

version: '3'
services:
  open3d-viewer:
    build: .
    image: open3d-viewer-image
    container_name: open3d-viewer
    volumes:
      - /tmp/.X11-unix/:/tmp/.X11-unix
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [compute, utility, graphics]
    environment:
      - DISPLAY=${DISPLAY}

参考

2
1
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
2
1