Mercurial > hg > orthanc-book
annotate Sphinx/source/users/docker.rst @ 618:cfeb018b9150 Orthanc-1.9.1
Orthanc 1.9.1
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 25 Feb 2021 19:06:06 +0100 |
parents | eaa6cdfa7ba6 |
children | 0e9f934fff44 |
rev | line source |
---|---|
54 | 1 .. _docker: |
2 .. highlight:: bash | |
3 | |
4 | |
5 Orthanc for Docker | |
6 ================== | |
7 | |
481
4f076a3b9934
unanswered-forum.rst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
461
diff
changeset
|
8 .. toctree:: |
4f076a3b9934
unanswered-forum.rst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
461
diff
changeset
|
9 :hidden: |
4f076a3b9934
unanswered-forum.rst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
461
diff
changeset
|
10 |
4f076a3b9934
unanswered-forum.rst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
461
diff
changeset
|
11 docker-osimis.rst |
4f076a3b9934
unanswered-forum.rst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
461
diff
changeset
|
12 |
4f076a3b9934
unanswered-forum.rst
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
461
diff
changeset
|
13 |
54 | 14 .. contents:: |
15 :depth: 3 | |
16 | |
17 | |
18 Introduction | |
19 ------------ | |
20 | |
21 `Docker images <https://en.wikipedia.org/wiki/Docker_(software)>`__ | |
22 for the Orthanc core and its official plugins are freely available on | |
23 the `DockerHub platform <https://hub.docker.com/u/jodogne/>`__. The | |
24 source code of the corresponding Docker images is available on `GitHub | |
25 <https://github.com/jodogne/OrthancDocker>`__. | |
26 | |
229 | 27 **Note about Orthanc vs. Osimis Docker images:** |
28 | |
29 * The ``jodogne/orthanc`` and ``jodogne/orthanc-plugins`` Docker | |
30 images that are described on this page are always kept in sync with | |
31 the latest releases of the Orthanc project, with a basic | |
32 configuration system that is inherited from the Debian packages | |
33 (i.e. manual edition of the configuration files). | |
34 | |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
35 * Our commercial partner `Osimis <https://www.osimis.io>`__ also |
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
36 `publishes separated Docker images |
393 | 37 <https://hub.docker.com/repository/docker/osimis/orthanc>`__. |
229 | 38 These ``osimis/orthanc`` images are used by the technical team of |
39 Osimis in order to provide professional support to their customers, | |
40 with a configuration system that can be tuned through environment | |
41 variables (which is very handy if using ``docker-compose``). These | |
42 images are not necessarily always in sync with the Orthanc project, | |
43 but they also include the :ref:`plugins edited by Osimis | |
44 <plugins-osimis>`, notably the Osimis Web viewer (that is much more | |
45 advanced than the Orthanc Web viewer) and the advanced authorization | |
396 | 46 plugin. A :ref:`specific page <docker-osimis>` is available to describe |
393 | 47 how these images should be used. |
229 | 48 |
49 **Note for CentOS users:** The Docker environment might be difficult to | |
54 | 50 configure on your platform. Hints are available on the `Orthanc Users |
51 discussion group | |
52 <https://groups.google.com/d/msg/orthanc-users/w-uPAknnRQc/-XhzBGSCAwAJ>`__. | |
53 | |
54 | |
55 Running the Orthanc core | |
56 ------------------------ | |
57 | |
58 The following command will start the core of Orthanc, with all the | |
59 plugins disabled:: | |
60 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
61 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc |
54 | 62 |
63 Once Orthanc is running, use Mozilla Firefox at URL | |
64 http://localhost:8042/ to interact with Orthanc. The default username | |
65 is ``orthanc`` and its password is ``orthanc``. | |
66 | |
67 The command above starts the mainline version of Orthanc, whose | |
69 | 68 development is in continuous progress. Do not forget to regularly |
69 update the Docker image to benefit from the latest features:: | |
70 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
71 $ docker pull jodogne/orthanc |
69 | 72 |
73 If more stability is required, you can select the official release of | |
74 Orthanc to be run:: | |
54 | 75 |
618 | 76 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc:1.9.1 |
54 | 77 |
78 Passing additional command-line options (e.g. to make Orthanc verbose) | |
79 can be done as follows (note the ``/etc/orthanc`` option that is | |
80 required for Orthanc to find its configuration files):: | |
81 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
82 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc /etc/orthanc --verbose |
54 | 83 |
84 | |
85 Usage, with plugins enabled | |
86 --------------------------- | |
87 | |
88 The following command will run the mainline version of the Orthanc | |
89 core, together with its :ref:`Web viewer <webviewer>`, its | |
90 :ref:`PostgreSQL support <postgresql>`, its :ref:`DICOMweb | |
91 implementation <dicomweb>`, and its :ref:`whole-slide imaging viewer | |
92 <wsi>`:: | |
93 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
94 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc-plugins |
54 | 95 |
365 | 96 Or you can also start a specific version of Orthanc for more stability:: |
97 | |
618 | 98 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc-plugins:1.9.1 |
365 | 99 |
364
234de55ed125
usage of the python plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
100 If you have an interest in the :ref:`Python plugin <python-plugin>`, |
234de55ed125
usage of the python plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
101 you can use the ``orthanc-python`` image. The latter image is a |
234de55ed125
usage of the python plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
102 heavier version of the ``orthanc-plugins`` image, as it embeds the |
234de55ed125
usage of the python plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
103 Python 3.7 interpreter. Here is how to start this image:: |
234de55ed125
usage of the python plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
104 |
365 | 105 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc-python |
618 | 106 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc-python:1.9.1 |
364
234de55ed125
usage of the python plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
363
diff
changeset
|
107 |
54 | 108 |
109 Fine-tuning the configuration | |
110 ----------------------------- | |
111 | |
112 For security reasons, you should at least protect your instance of | |
113 Orthanc by changing this default user, in the ``RegisteredUsers`` | |
114 :ref:`configuration option <configuration>`. You will also probably | |
115 need to fine-tune other parameters, notably the list of the DICOM | |
116 modalities Orthanc knows about. | |
117 | |
118 You can generate a custom configuration file for Orthanc as follows:: | |
119 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
120 $ docker run --rm --entrypoint=cat jodogne/orthanc /etc/orthanc/orthanc.json > /tmp/orthanc.json |
54 | 121 |
122 Then, edit the just-generated file ``/tmp/orthanc.json`` and restart | |
123 Orthanc with your updated configuration:: | |
124 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
125 $ docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc |
54 | 126 |
384
e4b0a4d69f42
note about memory usage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
127 *Remark:* These Docker images automatically set the environment |
e4b0a4d69f42
note about memory usage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
128 variable ``MALLOC_ARENA_MAX`` to ``5`` in order to :ref:`control |
e4b0a4d69f42
note about memory usage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
129 memory usage <scalability-memory>`. This default setting can be |
e4b0a4d69f42
note about memory usage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
130 overriden by providing the option ``-e MALLOC_ARENA_MAX=1`` when |
386 | 131 invoking ``docker run`` (the value ``0`` corresponds to the default |
132 value). | |
384
e4b0a4d69f42
note about memory usage
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
382
diff
changeset
|
133 |
54 | 134 |
382 | 135 .. _docker-compose: |
136 | |
137 Configuration management using Docker Compose | |
138 --------------------------------------------- | |
139 | |
140 Depending on the context, the `Docker Compose tool | |
141 <https://docs.docker.com/compose/>`__ might be easier to use than the | |
142 plain Docker tool, as it allows replacing long command lines as above, | |
143 by plain configuration files. The trick here is to provide the JSON | |
144 configuration files to Orthanc as `secrets | |
145 <https://docs.docker.com/compose/compose-file/#secrets>`__ (note that | |
146 the related option ``configs`` could in theory be better, | |
147 unfortunately it is only available to `Docker Swarm | |
148 <https://github.com/docker/compose/issues/5110>`__). | |
149 | |
150 .. highlight:: yml | |
151 | |
152 First create the ``docker-compose.yml`` file as follows (this one uses | |
153 the `YAML file format <https://en.wikipedia.org/wiki/YAML>`__):: | |
154 | |
155 version: '3.1' # Secrets are only available since this version of Docker Compose | |
156 services: | |
157 orthanc: | |
618 | 158 image: jodogne/orthanc-plugins:1.9.1 |
382 | 159 command: /run/secrets/ # Path to the configuration files (stored as secrets) |
160 ports: | |
402 | 161 - 4242:4242 |
382 | 162 - 8042:8042 |
163 secrets: | |
164 - orthanc.json | |
165 secrets: | |
166 orthanc.json: | |
167 file: orthanc.json | |
168 | |
169 .. highlight:: json | |
170 | |
171 Then, place the configuration file ``orthanc.json`` next to the | |
172 ``docker-compose.yml`` file. Here is a minimalist ``orthanc.json``:: | |
173 | |
174 { | |
175 "Name" : "Orthanc in Docker", | |
176 "RemoteAccessAllowed" : true | |
177 } | |
178 | |
179 .. highlight:: bash | |
180 | |
181 This single configuration file should contain all the required | |
182 configuration options for Orthanc and all its plugins. The container | |
183 can then be started as follows:: | |
184 | |
185 $ docker-compose up | |
186 | |
187 | |
54 | 188 Making the Orthanc database persistent |
189 -------------------------------------- | |
190 | |
191 The filesystem of Docker containers is volatile (its content is | |
192 deleted once the container stops). You can make the Orthanc database | |
193 persistent by mapping the ``/var/lib/orthanc/db`` folder of the | |
194 container to some path in the filesystem of your Linux host, e.g.:: | |
195 | |
196 $ mkdir /tmp/orthanc-db | |
618 | 197 $ docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc-db/:/var/lib/orthanc/db/ jodogne/orthanc:1.9.1 |
54 | 198 |
199 | |
200 Whole-slide imaging support | |
201 --------------------------- | |
202 | |
203 The ``orthanc-plugins`` image includes support for :ref:`microscopic | |
204 whole-slide imaging (WSI) <wsi>`. For instance, the following command | |
205 will start the WSI viewer plugin transparently together with Orthanc:: | |
206 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
207 $ docker run -p 4242:4242 -p 8042:8042 --rm --name orthanc-wsi jodogne/orthanc-plugins |
54 | 208 |
209 Note that we gave the name ``orthanc-wsi`` to this new Docker | |
210 container. Then, the Dicomizer command-line tool can be invoked as | |
211 follows:: | |
212 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
213 $ docker run -t -i --rm --link=orthanc-wsi:orthanc --entrypoint=OrthancWSIDicomizer -v /tmp/Source.tif:/tmp/Source.tif:ro jodogne/orthanc-plugins --username=orthanc --password=orthanc --orthanc=http://orthanc:8042/ /tmp/Source.tif |
54 | 214 |
215 This command needs a few explanations: | |
216 | |
217 * ``--link=orthanc-wsi:orthanc`` links the container running the | |
218 Dicomizer, to the Docker container running Orthanc that we started | |
219 just before. | |
220 * ``--entrypoint=OrthancWSIDicomizer`` specifies that the Dicomizer | |
221 must be run instead of the Orthanc server. | |
222 * ``-v /tmp/Source.tif:/tmp/Source.tif:ro`` maps the source image | |
223 ``/tmp/Source.tif`` on the host computer into the Orthanc container | |
224 as read-only file ``/tmp/Source.tif``. | |
225 * ``--orthanc=http://orthanc:8042/`` instructs the Dicomizer to push | |
226 images through the ``--link`` created above. | |
227 * ``--username=orthanc --password=orthanc`` correspond to the default | |
228 credentials of the ``orthanc-plugins`` image. | |
229 | |
230 Obviously, you are free to add all the options you wish (check out the | |
231 ``--help`` flag to list these options). In particular, the | |
232 ``--dataset`` option allows to specify DICOM tags, in the JSON file | |
233 format, so as to include them in the resulting DICOM series (the | |
234 option ``--sample-dataset`` prints a sample JSON file that has the | |
235 expected format). | |
236 | |
237 If you have a source image that is not a hierarchical TIFF, you must | |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
238 instruct the Dicomizer to use `OpenSlide <https://openslide.org/>`__ |
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
336
diff
changeset
|
239 to decode it by adding the ``--openslide`` option:: |
54 | 240 |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
241 $ docker run -t -i --rm --link=orthanc-wsi:orthanc --entrypoint=OrthancWSIDicomizer -v /tmp/Source.svs:/tmp/Source.svs:ro jodogne/orthanc-plugins --username=orthanc --password=orthanc --orthanc=http://orthanc:8042/ --openslide=libopenslide.so /tmp/Source.svs |
54 | 242 |
243 | |
244 PostgreSQL and Orthanc inside Docker | |
245 ------------------------------------ | |
246 | |
247 It is possible to run both Orthanc and PostgreSQL inside Docker. First, start the official PostgreSQL container:: | |
248 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
249 $ docker run --name some-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=pgpassword --rm postgres |
54 | 250 |
251 Open another shell, and create a database to host the Orthanc database:: | |
252 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
253 $ docker run -it --link some-postgres:postgres --rm postgres sh -c 'echo "CREATE DATABASE orthanc;" | exec psql -h "$POSTGRES_PORT_5432_TCP_ADDR" -p "$POSTGRES_PORT_5432_TCP_PORT" -U postgres' |
54 | 254 |
255 You will have to type the password (cf. the environment variable | |
256 ``POSTGRES_PASSWORD`` above that it set to ``pgpassword``). Then, | |
257 retrieve the IP and the port of the PostgreSQL container, together | |
258 with the default Orthanc configuration file:: | |
259 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
260 $ docker inspect --format '{{ .NetworkSettings.IPAddress }}' some-postgres |
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
261 $ docker inspect --format '{{ .NetworkSettings.Ports }}' some-postgres |
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
262 $ docker run --rm --entrypoint=cat jodogne/orthanc-plugins /etc/orthanc/orthanc.json > /tmp/orthanc.json |
54 | 263 |
264 .. highlight:: json | |
265 | |
266 Add the following section to ``/tmp/orthanc.json`` (adapting the | |
267 values Host and Port to what docker inspect said above):: | |
268 | |
269 "PostgreSQL" : { | |
270 "EnableIndex" : true, | |
271 "EnableStorage" : true, | |
272 "Host" : "172.17.0.38", | |
273 "Port" : 5432, | |
274 "Database" : "orthanc", | |
275 "Username" : "postgres", | |
276 "Password" : "pgpassword" | |
277 } | |
278 | |
279 .. highlight:: bash | |
280 | |
281 Finally, you can start Orthanc:: | |
282 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
283 $ docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc-plugins |
54 | 284 |
285 | |
286 Debugging | |
287 --------- | |
288 | |
176 | 289 .. highlight:: text |
290 | |
54 | 291 For debugging purpose, you can start an interactive bash session as |
292 follows:: | |
293 | |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
294 $ docker run -i -t --rm --entrypoint=bash jodogne/orthanc |
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
295 $ docker run -i -t --rm --entrypoint=bash jodogne/orthanc-plugins |
175 | 296 |
176 | 297 For developers and power users, the images ``jodogne/orthanc-debug`` |
298 contain the Orthanc core compiled in debug mode (i.e. with runtime | |
299 assertions enabled, and including debugging symbols). A ``gdb`` | |
177 | 300 command-line session can be started as follows:: |
176 | 301 |
363
9c28eeab2db6
removed sudo from docker
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
358
diff
changeset
|
302 $ docker run -i -t --rm --entrypoint=bash --network=host --cap-add=SYS_PTRACE -p 4242:4242 -p 8042:8042 jodogne/orthanc-debug |
176 | 303 # gdb --args Orthanc /etc/orthanc/ --verbose |
175 | 304 |
184 | 305 Exceptions can be automatically caught by launching ``gdb`` as follows:: |
306 | |
307 # gdb --ex 'catch t' --ex r --ex bt --args ./Orthanc /etc/orthanc/ --verbose | |
308 | |
176 | 309 Note that: |
310 | |
311 * The plugins are not available in this image yet. | |
312 | |
313 * The Orthanc source code can be found in folder ``/root/orthanc``. | |
314 | |
315 * The build artifacts can be found in folder ``/root/orthanc/Build``. | |
316 | |
317 * This command launches the mainline version. To start a released version, | |
618 | 318 use e.g. ``jodogne/orthanc-debug:1.9.1``. |