changeset 382:64b32cb19571

docker-compose
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 14 Apr 2020 12:36:57 +0200
parents c9fe3d0d0fa1
children ef0e45a9b08a e4b0a4d69f42
files Sphinx/source/users/docker.rst
diffstat 1 files changed, 52 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Sphinx/source/users/docker.rst	Wed Apr 08 08:49:59 2020 +0200
+++ b/Sphinx/source/users/docker.rst	Tue Apr 14 12:36:57 2020 +0200
@@ -118,6 +118,58 @@
   $ docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc
 
 
+.. _docker-compose:
+
+Configuration management using Docker Compose
+---------------------------------------------
+
+Depending on the context, the `Docker Compose tool
+<https://docs.docker.com/compose/>`__ might be easier to use than the
+plain Docker tool, as it allows replacing long command lines as above,
+by plain configuration files. The trick here is to provide the JSON
+configuration files to Orthanc as `secrets
+<https://docs.docker.com/compose/compose-file/#secrets>`__ (note that
+the related option ``configs`` could in theory be better,
+unfortunately it is only available to `Docker Swarm
+<https://github.com/docker/compose/issues/5110>`__).
+
+.. highlight:: yml
+
+First create the ``docker-compose.yml`` file as follows (this one uses
+the `YAML file format <https://en.wikipedia.org/wiki/YAML>`__)::
+
+  version: '3.1'  # Secrets are only available since this version of Docker Compose
+  services:
+    orthanc:
+      image: jodogne/orthanc-plugins:1.6.0
+      command: /run/secrets/  # Path to the configuration files (stored as secrets)
+      ports:
+        - 8042:8042
+      secrets:
+        - orthanc.json      
+  secrets:
+    orthanc.json:
+      file: orthanc.json
+
+.. highlight:: json
+
+Then, place the configuration file ``orthanc.json`` next to the
+``docker-compose.yml`` file. Here is a minimalist ``orthanc.json``::
+
+  {
+    "Name" : "Orthanc in Docker",
+    "RemoteAccessAllowed" : true
+  }
+
+.. highlight:: bash
+
+This single configuration file should contain all the required
+configuration options for Orthanc and all its plugins. The container
+can then be started as follows::
+
+  $ docker-compose up
+               
+
 Making the Orthanc database persistent
 --------------------------------------