annotate Sphinx/source/users/docker.rst @ 54:bd0fbf1f0143

docker documentation
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 08 Nov 2016 14:51:11 +0100
parents
children 03d35f985f26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
54
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 .. _docker:
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 .. highlight:: bash
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 Orthanc for Docker
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 ==================
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 .. contents::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 :depth: 3
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 Introduction
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 ------------
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 `Docker images <https://en.wikipedia.org/wiki/Docker_(software)>`__
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 for the Orthanc core and its official plugins are freely available on
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 the `DockerHub platform <https://hub.docker.com/u/jodogne/>`__. The
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 source code of the corresponding Docker images is available on `GitHub
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 <https://github.com/jodogne/OrthancDocker>`__.
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 *Note for CentOS users:* The Docker environment might be difficult to
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 configure on your platform. Hints are available on the `Orthanc Users
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 discussion group
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 <https://groups.google.com/d/msg/orthanc-users/w-uPAknnRQc/-XhzBGSCAwAJ>`__.
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 Running the Orthanc core
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 ------------------------
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 The following command will start the core of Orthanc, with all the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 plugins disabled::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 Once Orthanc is running, use Mozilla Firefox at URL
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 http://localhost:8042/ to interact with Orthanc. The default username
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 is ``orthanc`` and its password is ``orthanc``.
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 The command above starts the mainline version of Orthanc, whose
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 development is in continuous progress. This gives you access to the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 latest features. If more stability is required, you can select the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 release of Orthanc to be run::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc:1.1.0
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 Passing additional command-line options (e.g. to make Orthanc verbose)
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 can be done as follows (note the ``/etc/orthanc`` option that is
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 required for Orthanc to find its configuration files)::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc /etc/orthanc --verbose
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 Usage, with plugins enabled
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 ---------------------------
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 The following command will run the mainline version of the Orthanc
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 core, together with its :ref:`Web viewer <webviewer>`, its
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 :ref:`PostgreSQL support <postgresql>`, its :ref:`DICOMweb
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 implementation <dicomweb>`, and its :ref:`whole-slide imaging viewer
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 <wsi>`::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc-plugins
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 Fine-tuning the configuration
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 -----------------------------
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 For security reasons, you should at least protect your instance of
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 Orthanc by changing this default user, in the ``RegisteredUsers``
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 :ref:`configuration option <configuration>`. You will also probably
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 need to fine-tune other parameters, notably the list of the DICOM
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 modalities Orthanc knows about.
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 You can generate a custom configuration file for Orthanc as follows::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 $ sudo docker run --rm --entrypoint=cat jodogne/orthanc /etc/orthanc/orthanc.json > /tmp/orthanc.json
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 Then, edit the just-generated file ``/tmp/orthanc.json`` and restart
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 Orthanc with your updated configuration::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 Making the Orthanc database persistent
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 --------------------------------------
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 The filesystem of Docker containers is volatile (its content is
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 deleted once the container stops). You can make the Orthanc database
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 persistent by mapping the ``/var/lib/orthanc/db`` folder of the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 container to some path in the filesystem of your Linux host, e.g.::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 $ mkdir /tmp/orthanc-db
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc-db/:/var/lib/orthanc/db/ jodogne/orthanc:1.1.0
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 Whole-slide imaging support
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 ---------------------------
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 The ``orthanc-plugins`` image includes support for :ref:`microscopic
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 whole-slide imaging (WSI) <wsi>`. For instance, the following command
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 will start the WSI viewer plugin transparently together with Orthanc::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm --name orthanc-wsi jodogne/orthanc-plugins
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 Note that we gave the name ``orthanc-wsi`` to this new Docker
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 container. Then, the Dicomizer command-line tool can be invoked as
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 follows::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 $ 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
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
110
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
111 This command needs a few explanations:
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 * ``--link=orthanc-wsi:orthanc`` links the container running the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 Dicomizer, to the Docker container running Orthanc that we started
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 just before.
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 * ``--entrypoint=OrthancWSIDicomizer`` specifies that the Dicomizer
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
117 must be run instead of the Orthanc server.
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
118 * ``-v /tmp/Source.tif:/tmp/Source.tif:ro`` maps the source image
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
119 ``/tmp/Source.tif`` on the host computer into the Orthanc container
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
120 as read-only file ``/tmp/Source.tif``.
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121 * ``--orthanc=http://orthanc:8042/`` instructs the Dicomizer to push
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 images through the ``--link`` created above.
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
123 * ``--username=orthanc --password=orthanc`` correspond to the default
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
124 credentials of the ``orthanc-plugins`` image.
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 Obviously, you are free to add all the options you wish (check out the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
127 ``--help`` flag to list these options). In particular, the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
128 ``--dataset`` option allows to specify DICOM tags, in the JSON file
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
129 format, so as to include them in the resulting DICOM series (the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
130 option ``--sample-dataset`` prints a sample JSON file that has the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
131 expected format).
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 If you have a source image that is not a hierarchical TIFF, you must
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 instruct the Dicomizer to use `OpenSlide <http://openslide.org/>`__ to
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 decode it by adding the ``--openslide`` option::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 $ 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
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 PostgreSQL and Orthanc inside Docker
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 ------------------------------------
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 It is possible to run both Orthanc and PostgreSQL inside Docker. First, start the official PostgreSQL container::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 $ sudo docker run --name some-postgres -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=pgpassword --rm postgres
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 Open another shell, and create a database to host the Orthanc database::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 $ 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'
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 You will have to type the password (cf. the environment variable
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 ``POSTGRES_PASSWORD`` above that it set to ``pgpassword``). Then,
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 retrieve the IP and the port of the PostgreSQL container, together
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 with the default Orthanc configuration file::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 $ sudo docker inspect --format '{{ .NetworkSettings.IPAddress }}' some-postgres
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 $ sudo docker inspect --format '{{ .NetworkSettings.Ports }}' some-postgres
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 $ sudo docker run --rm --entrypoint=cat jodogne/orthanc-plugins /etc/orthanc/orthanc.json > /tmp/orthanc.json
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 .. highlight:: json
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 Add the following section to ``/tmp/orthanc.json`` (adapting the
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 values Host and Port to what docker inspect said above)::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 "PostgreSQL" : {
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 "EnableIndex" : true,
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 "EnableStorage" : true,
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 "Host" : "172.17.0.38",
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 "Port" : 5432,
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 "Database" : "orthanc",
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 "Username" : "postgres",
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 "Password" : "pgpassword"
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 }
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 .. highlight:: bash
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 Finally, you can start Orthanc::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 $ sudo docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc-plugins
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 Debugging
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 ---------
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 For debugging purpose, you can start an interactive bash session as
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 follows::
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 $ sudo docker run -i -t --rm --entrypoint=bash jodogne/orthanc
bd0fbf1f0143 docker documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 $ sudo docker run -i -t --rm --entrypoint=bash jodogne/orthanc-plugins