@@ -30,10 +30,11 @@ Python applications looks like this:
3030.. code-block :: dockerfile
3131
3232 # This could also be another Ubuntu or Debian based distribution
33- FROM ubuntu:latest
33+ FROM ubuntu:22.04
3434
3535 # Install Open3D system dependencies and pip
3636 RUN apt-get update && apt-get install --no-install-recommends -y \
37+ libegl1 \
3738 libgl1 \
3839 libgomp1 \
3940 python3-pip \
@@ -52,11 +53,11 @@ To run GUI applications from the docker container, add these options to the
5253
53541. GPU:
5455
55- - Intel (Mesa drivers): ``--device=/dev/dri:/dev/dri ``
56+ - Intel (Mesa drivers): ``--device=/dev/dri:/dev/dri `` or `` --device=/dev/dri/card0:/dev/dri/card0 --device=/dev/dri/renderD128:/dev/dri/renderD128 ``, depending on your hardware.
5657
5758 - NVIDIA: ``--gpus 'all,"capabilities=compute,utility,graphics"' ``
5859
59- - No GPU (CPU rendering): ``--env OPEN3D_CPU_RENDERING=true ``
60+ - No GPU (CPU rendering): ``--env OPEN3D_CPU_RENDERING=true `` on Ubuntu 18.04. Later versions automaticaly select CPU rendering if a GPU is not available.
6061
61622. X server: ``-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY ``
6263
@@ -72,7 +73,7 @@ folder that contains data you wish to visualize.
7273 wget https://github.com/isl-org/Open3D/releases/download/v@OPEN3D_VERSION@/open3d-app-@OPEN3D_VERSION@-Ubuntu.deb
7374 # Build docker image in folder containing Open3D deb package.
7475 docker build -t open3d-viewer -f- . << EOF
75- FROM ubuntu:latest
76+ FROM ubuntu:20.04
7677 COPY open3d*.deb /root/
7778 RUN apt-get update \
7879 && apt-get install --yes /root/open3d*.deb \
@@ -91,30 +92,65 @@ folder that contains data you wish to visualize.
9192 -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY \
9293 -v "$PWD ":/root open3d-viewer:latest
9394 # Run Open3D viewer docker image without a GPU (CPU rendering)
94- docker run --env OPEN3D_CPU_RENDERING=true\
95- -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY \
95+ docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY \
9696 -v "$PWD ":/root open3d-viewer:latest
9797
9898Also see the ` docker tutorial for ROS
9999< http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration> ` __ for more
100- information.
100+ information. Note that differences in hardware, OS drivers and OS packages may
101+ require you to modify these instructions.
101102
102103
103104Headless rendering
104105------------------
105106If a GUI display server (X11 or Wayland) is not available (either in the docker
106- container or the host OS), Open3D can still be used for headless rendering. This
107- requires installing some additional dependencies. Here is an example Ubuntu /
108- Debian based docker file that runs the ` ` render_to_image.py` ` rendering example.
109- Other Linux (e.g. RHEL) distributions will need different dependency packages.
107+ container or the host OS), Open3D can still be used for headless rendering. In
108+ Ubuntu 20.04+ (with Mesa version 20.2+) this requires configuring the Mesa
109+ driver with an environment variable (` ` EGL_PLATFORM=surfaceless` ` ):
110+
111+ .. code-block:: bash
112+
113+ mkdir open3d-headless-docker && cd open3d-headless-docker
114+ wget https://raw.githubusercontent.com/isl-org/Open3D/v@OPEN3D_VERSION@/examples/python/visualization/render_to_image.py
115+ # Build docker image
116+ docker build -t open3d-headless -f- . <<EOF
117+ FROM ubuntu:20.04
118+ RUN apt-get update \
119+ && apt-get install --yes --no-install-recommends \
120+ libegl1 libgl1 libgomp1 python3-pip \
121+ && rm -rf /var/lib/apt/lists/*
122+
123+ # Install Open3D from the PyPI repositories
124+ RUN python3 -m pip install --no-cache-dir --upgrade pip && \
125+ python3 -m pip install --no-cache-dir --upgrade open3d==@OPEN3D_VERSION@
126+
127+ # Configure Mesa EGL for headless rendering
128+ ENV EGL_PLATFORM=surfaceless
129+ WORKDIR /root/
130+ ENTRYPOINT ["python3", "/root/render_to_image.py"]
131+ EOF
132+
133+ # Run headless rendering example with Intel GPU
134+ docker run --device=/dev/dri:/dev/dri \
135+ -v "$PWD ":/root open3d-headless:latest
136+ # Run headless rendering example with Nvidia GPU
137+ docker run --gpus 'all,"capabilities=compute,utility,graphics"' \
138+ -v "$PWD ":/root open3d-headless:latest
139+ # Run headless rendering example without GPU (CPU rendering)
140+ docker run -v "$PWD ":/root open3d-headless:latest
141+
142+ In Ubuntu 18.04, we need to install some additional dependencies. Here is an
143+ example Ubuntu / Debian based docker file that runs the ` ` render_to_image.py` `
144+ rendering example. Other (old) Linux (e.g. RHEL) distributions will need
145+ different dependency packages.
110146
111147.. code-block:: bash
112148
113149 mkdir open3d-headless-docker && cd open3d-headless-docker
114150 wget https://raw.githubusercontent.com/isl-org/Open3D/v@OPEN3D_VERSION@/examples/python/visualization/render_to_image.py
115151 # Build docker image
116152 docker build -t open3d-headless -f- . <<EOF
117- FROM ubuntu:latest
153+ FROM ubuntu:18.04
118154 RUN apt-get update \
119155 && apt-get install --yes --no-install-recommends \
120156 libgl1 libgomp1 python3-pip \
0 commit comments