comparison Sphinx/source/users/docker.rst @ 363:9c28eeab2db6

removed sudo from docker
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 31 Mar 2020 17:27:55 +0200
parents 011b01ccf52d
children 234de55ed125
comparison
equal deleted inserted replaced
362:022d59428ea3 363:9c28eeab2db6
49 ------------------------ 49 ------------------------
50 50
51 The following command will start the core of Orthanc, with all the 51 The following command will start the core of Orthanc, with all the
52 plugins disabled:: 52 plugins disabled::
53 53
54 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc 54 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc
55 55
56 Once Orthanc is running, use Mozilla Firefox at URL 56 Once Orthanc is running, use Mozilla Firefox at URL
57 http://localhost:8042/ to interact with Orthanc. The default username 57 http://localhost:8042/ to interact with Orthanc. The default username
58 is ``orthanc`` and its password is ``orthanc``. 58 is ``orthanc`` and its password is ``orthanc``.
59 59
60 The command above starts the mainline version of Orthanc, whose 60 The command above starts the mainline version of Orthanc, whose
61 development is in continuous progress. Do not forget to regularly 61 development is in continuous progress. Do not forget to regularly
62 update the Docker image to benefit from the latest features:: 62 update the Docker image to benefit from the latest features::
63 63
64 $ sudo docker pull jodogne/orthanc 64 $ docker pull jodogne/orthanc
65 65
66 If more stability is required, you can select the official release of 66 If more stability is required, you can select the official release of
67 Orthanc to be run:: 67 Orthanc to be run::
68 68
69 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc:1.6.0 69 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc:1.6.0
70 70
71 Passing additional command-line options (e.g. to make Orthanc verbose) 71 Passing additional command-line options (e.g. to make Orthanc verbose)
72 can be done as follows (note the ``/etc/orthanc`` option that is 72 can be done as follows (note the ``/etc/orthanc`` option that is
73 required for Orthanc to find its configuration files):: 73 required for Orthanc to find its configuration files)::
74 74
75 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc /etc/orthanc --verbose 75 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc /etc/orthanc --verbose
76 76
77 77
78 Usage, with plugins enabled 78 Usage, with plugins enabled
79 --------------------------- 79 ---------------------------
80 80
82 core, together with its :ref:`Web viewer <webviewer>`, its 82 core, together with its :ref:`Web viewer <webviewer>`, its
83 :ref:`PostgreSQL support <postgresql>`, its :ref:`DICOMweb 83 :ref:`PostgreSQL support <postgresql>`, its :ref:`DICOMweb
84 implementation <dicomweb>`, and its :ref:`whole-slide imaging viewer 84 implementation <dicomweb>`, and its :ref:`whole-slide imaging viewer
85 <wsi>`:: 85 <wsi>`::
86 86
87 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc-plugins 87 $ docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc-plugins
88 88
89 89
90 Fine-tuning the configuration 90 Fine-tuning the configuration
91 ----------------------------- 91 -----------------------------
92 92
96 need to fine-tune other parameters, notably the list of the DICOM 96 need to fine-tune other parameters, notably the list of the DICOM
97 modalities Orthanc knows about. 97 modalities Orthanc knows about.
98 98
99 You can generate a custom configuration file for Orthanc as follows:: 99 You can generate a custom configuration file for Orthanc as follows::
100 100
101 $ sudo docker run --rm --entrypoint=cat jodogne/orthanc /etc/orthanc/orthanc.json > /tmp/orthanc.json 101 $ docker run --rm --entrypoint=cat jodogne/orthanc /etc/orthanc/orthanc.json > /tmp/orthanc.json
102 102
103 Then, edit the just-generated file ``/tmp/orthanc.json`` and restart 103 Then, edit the just-generated file ``/tmp/orthanc.json`` and restart
104 Orthanc with your updated configuration:: 104 Orthanc with your updated configuration::
105 105
106 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc 106 $ docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc
107 107
108 108
109 Making the Orthanc database persistent 109 Making the Orthanc database persistent
110 -------------------------------------- 110 --------------------------------------
111 111
113 deleted once the container stops). You can make the Orthanc database 113 deleted once the container stops). You can make the Orthanc database
114 persistent by mapping the ``/var/lib/orthanc/db`` folder of the 114 persistent by mapping the ``/var/lib/orthanc/db`` folder of the
115 container to some path in the filesystem of your Linux host, e.g.:: 115 container to some path in the filesystem of your Linux host, e.g.::
116 116
117 $ mkdir /tmp/orthanc-db 117 $ mkdir /tmp/orthanc-db
118 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc-db/:/var/lib/orthanc/db/ jodogne/orthanc:1.6.0 118 $ docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc-db/:/var/lib/orthanc/db/ jodogne/orthanc:1.6.0
119 119
120 120
121 Whole-slide imaging support 121 Whole-slide imaging support
122 --------------------------- 122 ---------------------------
123 123
124 The ``orthanc-plugins`` image includes support for :ref:`microscopic 124 The ``orthanc-plugins`` image includes support for :ref:`microscopic
125 whole-slide imaging (WSI) <wsi>`. For instance, the following command 125 whole-slide imaging (WSI) <wsi>`. For instance, the following command
126 will start the WSI viewer plugin transparently together with Orthanc:: 126 will start the WSI viewer plugin transparently together with Orthanc::
127 127
128 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm --name orthanc-wsi jodogne/orthanc-plugins 128 $ docker run -p 4242:4242 -p 8042:8042 --rm --name orthanc-wsi jodogne/orthanc-plugins
129 129
130 Note that we gave the name ``orthanc-wsi`` to this new Docker 130 Note that we gave the name ``orthanc-wsi`` to this new Docker
131 container. Then, the Dicomizer command-line tool can be invoked as 131 container. Then, the Dicomizer command-line tool can be invoked as
132 follows:: 132 follows::
133 133
134 $ sudo 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 134 $ 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
135 135
136 This command needs a few explanations: 136 This command needs a few explanations:
137 137
138 * ``--link=orthanc-wsi:orthanc`` links the container running the 138 * ``--link=orthanc-wsi:orthanc`` links the container running the
139 Dicomizer, to the Docker container running Orthanc that we started 139 Dicomizer, to the Docker container running Orthanc that we started
157 157
158 If you have a source image that is not a hierarchical TIFF, you must 158 If you have a source image that is not a hierarchical TIFF, you must
159 instruct the Dicomizer to use `OpenSlide <https://openslide.org/>`__ 159 instruct the Dicomizer to use `OpenSlide <https://openslide.org/>`__
160 to decode it by adding the ``--openslide`` option:: 160 to decode it by adding the ``--openslide`` option::
161 161
162 $ sudo 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 162 $ 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
163 163
164 164
165 PostgreSQL and Orthanc inside Docker 165 PostgreSQL and Orthanc inside Docker
166 ------------------------------------ 166 ------------------------------------
167 167
168 It is possible to run both Orthanc and PostgreSQL inside Docker. First, start the official PostgreSQL container:: 168 It is possible to run both Orthanc and PostgreSQL inside Docker. First, start the official PostgreSQL container::
169 169
170 $ sudo docker run --name some-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=pgpassword --rm postgres 170 $ docker run --name some-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=pgpassword --rm postgres
171 171
172 Open another shell, and create a database to host the Orthanc database:: 172 Open another shell, and create a database to host the Orthanc database::
173 173
174 $ sudo 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' 174 $ 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'
175 175
176 You will have to type the password (cf. the environment variable 176 You will have to type the password (cf. the environment variable
177 ``POSTGRES_PASSWORD`` above that it set to ``pgpassword``). Then, 177 ``POSTGRES_PASSWORD`` above that it set to ``pgpassword``). Then,
178 retrieve the IP and the port of the PostgreSQL container, together 178 retrieve the IP and the port of the PostgreSQL container, together
179 with the default Orthanc configuration file:: 179 with the default Orthanc configuration file::
180 180
181 $ sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' some-postgres 181 $ docker inspect --format '{{ .NetworkSettings.IPAddress }}' some-postgres
182 $ sudo docker inspect --format '{{ .NetworkSettings.Ports }}' some-postgres 182 $ docker inspect --format '{{ .NetworkSettings.Ports }}' some-postgres
183 $ sudo docker run --rm --entrypoint=cat jodogne/orthanc-plugins /etc/orthanc/orthanc.json > /tmp/orthanc.json 183 $ docker run --rm --entrypoint=cat jodogne/orthanc-plugins /etc/orthanc/orthanc.json > /tmp/orthanc.json
184 184
185 .. highlight:: json 185 .. highlight:: json
186 186
187 Add the following section to ``/tmp/orthanc.json`` (adapting the 187 Add the following section to ``/tmp/orthanc.json`` (adapting the
188 values Host and Port to what docker inspect said above):: 188 values Host and Port to what docker inspect said above)::
199 199
200 .. highlight:: bash 200 .. highlight:: bash
201 201
202 Finally, you can start Orthanc:: 202 Finally, you can start Orthanc::
203 203
204 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc-plugins 204 $ docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc-plugins
205 205
206 206
207 Debugging 207 Debugging
208 --------- 208 ---------
209 209
210 .. highlight:: text 210 .. highlight:: text
211 211
212 For debugging purpose, you can start an interactive bash session as 212 For debugging purpose, you can start an interactive bash session as
213 follows:: 213 follows::
214 214
215 $ sudo docker run -i -t --rm --entrypoint=bash jodogne/orthanc 215 $ docker run -i -t --rm --entrypoint=bash jodogne/orthanc
216 $ sudo docker run -i -t --rm --entrypoint=bash jodogne/orthanc-plugins 216 $ docker run -i -t --rm --entrypoint=bash jodogne/orthanc-plugins
217 217
218 For developers and power users, the images ``jodogne/orthanc-debug`` 218 For developers and power users, the images ``jodogne/orthanc-debug``
219 contain the Orthanc core compiled in debug mode (i.e. with runtime 219 contain the Orthanc core compiled in debug mode (i.e. with runtime
220 assertions enabled, and including debugging symbols). A ``gdb`` 220 assertions enabled, and including debugging symbols). A ``gdb``
221 command-line session can be started as follows:: 221 command-line session can be started as follows::
222 222
223 $ sudo docker run -i -t --rm --entrypoint=bash --network=host --cap-add=SYS_PTRACE -p 4242:4242 -p 8042:8042 jodogne/orthanc-debug 223 $ docker run -i -t --rm --entrypoint=bash --network=host --cap-add=SYS_PTRACE -p 4242:4242 -p 8042:8042 jodogne/orthanc-debug
224 # gdb --args Orthanc /etc/orthanc/ --verbose 224 # gdb --args Orthanc /etc/orthanc/ --verbose
225 225
226 Exceptions can be automatically caught by launching ``gdb`` as follows:: 226 Exceptions can be automatically caught by launching ``gdb`` as follows::
227 227
228 # gdb --ex 'catch t' --ex r --ex bt --args ./Orthanc /etc/orthanc/ --verbose 228 # gdb --ex 'catch t' --ex r --ex bt --args ./Orthanc /etc/orthanc/ --verbose