@@ -30,10 +30,11 @@ Python applications looks like this:
30
30
.. code-block :: dockerfile
31
31
32
32
# This could also be another Ubuntu or Debian based distribution
33
- FROM ubuntu:latest
33
+ FROM ubuntu:22.04
34
34
35
35
# Install Open3D system dependencies and pip
36
36
RUN apt-get update && apt-get install --no-install-recommends -y \
37
+ libegl1 \
37
38
libgl1 \
38
39
libgomp1 \
39
40
python3-pip \
@@ -52,11 +53,11 @@ To run GUI applications from the docker container, add these options to the
52
53
53
54
1. GPU:
54
55
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.
56
57
57
58
- NVIDIA: ``--gpus 'all,"capabilities=compute,utility,graphics"' ``
58
59
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.
60
61
61
62
2. X server: ``-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY ``
62
63
@@ -72,7 +73,7 @@ folder that contains data you wish to visualize.
72
73
wget https://github.com/isl-org/Open3D/releases/download/v@OPEN3D_VERSION@/open3d-app-@[email protected]
73
74
# Build docker image in folder containing Open3D deb package.
74
75
docker build -t open3d-viewer -f- . << EOF
75
- FROM ubuntu:latest
76
+ FROM ubuntu:20.04
76
77
COPY open3d*.deb /root/
77
78
RUN apt-get update \
78
79
&& apt-get install --yes /root/open3d*.deb \
@@ -91,30 +92,65 @@ folder that contains data you wish to visualize.
91
92
-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY \
92
93
-v "$PWD ":/root open3d-viewer:latest
93
94
# 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 \
96
96
-v "$PWD ":/root open3d-viewer:latest
97
97
98
98
Also see the ` docker tutorial for ROS
99
99
< 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.
101
102
102
103
103
104
Headless rendering
104
105
------------------
105
106
If 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.
110
146
111
147
.. code-block:: bash
112
148
113
149
mkdir open3d-headless-docker && cd open3d-headless-docker
114
150
wget https://raw.githubusercontent.com/isl-org/Open3D/v@OPEN3D_VERSION@/examples/python/visualization/render_to_image.py
115
151
# Build docker image
116
152
docker build -t open3d-headless -f- . <<EOF
117
- FROM ubuntu:latest
153
+ FROM ubuntu:18.04
118
154
RUN apt-get update \
119
155
&& apt-get install --yes --no-install-recommends \
120
156
libgl1 libgomp1 python3-pip \
0 commit comments