comparison Sphinx/source/users/docker.rst @ 382:64b32cb19571

docker-compose
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 14 Apr 2020 12:36:57 +0200
parents 49202601d0c8
children e4b0a4d69f42
comparison
equal deleted inserted replaced
379:c9fe3d0d0fa1 382:64b32cb19571
116 Orthanc with your updated configuration:: 116 Orthanc with your updated configuration::
117 117
118 $ docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc 118 $ docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc
119 119
120 120
121 .. _docker-compose:
122
123 Configuration management using Docker Compose
124 ---------------------------------------------
125
126 Depending on the context, the `Docker Compose tool
127 <https://docs.docker.com/compose/>`__ might be easier to use than the
128 plain Docker tool, as it allows replacing long command lines as above,
129 by plain configuration files. The trick here is to provide the JSON
130 configuration files to Orthanc as `secrets
131 <https://docs.docker.com/compose/compose-file/#secrets>`__ (note that
132 the related option ``configs`` could in theory be better,
133 unfortunately it is only available to `Docker Swarm
134 <https://github.com/docker/compose/issues/5110>`__).
135
136 .. highlight:: yml
137
138 First create the ``docker-compose.yml`` file as follows (this one uses
139 the `YAML file format <https://en.wikipedia.org/wiki/YAML>`__)::
140
141 version: '3.1' # Secrets are only available since this version of Docker Compose
142 services:
143 orthanc:
144 image: jodogne/orthanc-plugins:1.6.0
145 command: /run/secrets/ # Path to the configuration files (stored as secrets)
146 ports:
147 - 8042:8042
148 secrets:
149 - orthanc.json
150 secrets:
151 orthanc.json:
152 file: orthanc.json
153
154 .. highlight:: json
155
156 Then, place the configuration file ``orthanc.json`` next to the
157 ``docker-compose.yml`` file. Here is a minimalist ``orthanc.json``::
158
159 {
160 "Name" : "Orthanc in Docker",
161 "RemoteAccessAllowed" : true
162 }
163
164 .. highlight:: bash
165
166 This single configuration file should contain all the required
167 configuration options for Orthanc and all its plugins. The container
168 can then be started as follows::
169
170 $ docker-compose up
171
172
121 Making the Orthanc database persistent 173 Making the Orthanc database persistent
122 -------------------------------------- 174 --------------------------------------
123 175
124 The filesystem of Docker containers is volatile (its content is 176 The filesystem of Docker containers is volatile (its content is
125 deleted once the container stops). You can make the Orthanc database 177 deleted once the container stops). You can make the Orthanc database