Is there a way to map a Docker Orthanc Log to a File on the Host.

I’m running a modified version of one of the Osimis recipes for a Docker container running Orthanc. It works fine, except I’d like to have log files for Orthanc available on the host file system.

As it is now, when I start up the containers via the CLI with:

sudo docker-compose up --build (in the foreground), all of the docker-logs are output to the terminal. e.g., which actually is usually fine for development because there is real-time feedback.

pacs-1_1 | W0317 14:55:58.910386 HttpClient.cpp:1132] HTTPS will use the CA certificates from this file: /etc/ssl/certs/ca-certificates.crt
pacs-1_1 | W0317 14:55:58.921744 LuaContext.cpp:93] Lua says: Lua toolbox installed
pacs-1_1 | W0317 14:55:58.923187 LuaContext.cpp:93] Lua says: Lua toolbox installed
pacs-1_1 | W0317 14:55:58.925191 ServerContext.cpp:478] Disk compression is disabled
pacs-1_1 | W0317 14:55:58.925322 ServerIndex.cpp:1659] No limit on the number of stored patients
pacs-1_1 | W0317 14:55:58.927306 ServerIndex.cpp:1676] No limit on the size of the storage area
pacs-1_1 | W0317 14:55:58.938596 ServerContext.cpp:220] Reloading the jobs from the last execution of Orthanc
pacs-1_1 | W0317 14:55:58.939978 JobsEngine.cpp:271] The jobs engine has started with 2 threads
pacs-1_1 | W0317 14:55:58.946106 main.cpp:1194] DICOM server listening with AET SCOTTI_CUSTOM on port: 4242
pacs-1_1 | W0317 14:55:58.946217 HttpServer.cpp:1982] HTTP compression is enabled
pacs-1_1 | W0317 14:55:58.946226 main.cpp:951] ====> Remote access is enabled while user authentication is explicitly disabled, your setup is POSSIBLY INSECURE <====
pacs-1_1 | W0317 14:55:58.946257 main.cpp:1073] Remote LUA script execution is disabled
pacs-1_1 | W0317 14:55:58.975637 HttpServer.cpp:1759] HTTP server listening on port: 8042 (HTTPS encryption is disabled, remote access is allowed)
pacs-1_1 | W0317 14:55:58.977696 main.cpp:827] Orthanc has started

I’d like to write the logs to a file in the Docker Container, and then bind that to a folder / file on the host, like for volumes in the docker-compose.yml.

  • ./orthanc-logs:/path/to/dockerlog/orthanc.log

In the Orthanc Book there is some info about doing that:

sudo docker run -a stderr -p 4242:4242 -p 8042:8042 --rm jodogne/orthanc --verbose /etc/orthanc > Orthanc.log 2>&1

But, not sure how to do that from the DockerFile. My Docker File for Orthanc is:
FROM osimis/orthanc

disable http bundle since we’re specifying http parameters in the orthanc.json configuration file


disable the auth defaults since we specify them in orthanc.json


COPY orthanc.json /etc/orthanc/

RUN pip3 install pydicom
RUN pip3 install pdfkit
RUN pip3 install hl7
RUN pip3 install wkhtmltopdf
RUN pip3 install mysql-connector-python
RUN pip3 install requests

The 2 below will be replaced by Mirth / Nextgen

RUN pip3 install aiorun

RUN pip3 install asyncio

RUN mkdir /etc/orthanc/dicomFiles
COPY dicomFiles/. /etc/orthanc/dicomFiles/

RUN mkdir /python

COPY python/ /python, bound to folder on host where script is

COPY lua/scriptname.lua /etc/orthanc/scriptname.lua

RUN apt-get update
RUN apt-get --assume-yes install wkhtmltopdf
RUN apt-get --assume-yes install dcmtk

Hi Stephen,

I had the same question a while back; configuring log files is not a standard feature of the docker image. I needed to override the / script in the image to not bail out on extra parameters; then I proceeded like this in the Dockerfile:


CMD /tmp/orthanc.json --logdir=/var/log/orthanc/

Of course, you could also use a --logfile argument there.

I was thinking to file an issue against the osimis/orthanc script to make this customization easier - after all the Orthanc executable will fail on its own when it receives invalid arguments.


Walco, Thanks for that. Probably needs a bit more tweaking, but I created my own like you said: That sort of hard codes the logs to be in /etc/orthanc/logs.xxxxx.log in the container, and I map that ./orthanc-logs:/etc/orthanc/logs on my host. That seems to work. I get a log file like:

log.2021.03.25-21.27.27…log on the host in orthanc-logs folder at the root of my docker-compose.yml. Using an ENV setting or a setting for that in the .json config would be nice. Now I can launch the container in the background and still have easy access to log file.

#!/usr/bin/env bash
set -o errexit
current_time=$(date “+%Y.%m.%d-%H.%M.%S”)

generate the configuration file

cd /startup

if [[ $TRACE_ENABLED == true ]]; then
elif [[ $VERBOSE_ENABLED == true ]]; then

if [[ $NO_JOBS == true ]]; then

if [[ $UNLOCK == true ]]; then

argv=(Orthanc $verbosity $jobs $unlock $logfile “$@”)
echo “Startup command: ${argv[*]}” >&2
exec “${argv[@]}”