Synology Docker issues

Dear Folks,

I have a DS916+ Synology NAS which has 4 core intel cpu and 8Gb ram.
The Synology operation system has a built in DOCKER and I can download docker images from docker hub directly. I have a latest version.

Some days ago I wanted to install a dicom server onto that NAS.
When I pull and start your docker images (jodogne/orthanc and jodogne/orthanc-plugins both v1.2 as latest) I can start it easily. When I try to modify something in the configuration file /etc/orthanc/orthanc.json after it when I restart the docker container that wont restart and stay stopped.

How can I easily edit the configuration file withour crash? In this situation I needed to clean the container and start to try modify again. Sometimes Im lucky, sometimes not.

You've not provided enough detail to converge on a solution here, so I
have a couple of questions:

1) What are the container logs from when you try and restart it?
2) What edits are you making to the configuration file? Are you
*certain* you're not introducing syntax errors that make it not
well-formatted json?

-ea

Hello,

Please make sure to read the following part of the Orthanc Book:
http://book.orthanc-server.com/users/docker.html#fine-tuning-the-configuration

To debug your configuration file, first make sure it is valid JSON, e.g. by running the command-line tool “jsonlint” on it (instructions below are for Ubuntu 16.04):

sudo apt-get install python-demjson

jsonlint-py -Sf ./Configuration.json

If Orthanc fails to start, run it in verbose mode by adding the arguments “/etc/orthanc --verbose”, as explained in the last paragraph of this section:
http://book.orthanc-server.com/users/docker.html#running-the-orthanc-core

Sébastien-

Dear Sebastien,

I read fine-tuning-the-configuration, but got some issues:

1.: I can get the copied configuration fileto the / thats ok.
2.: I can stop Orthanc with this command:

root@jodogne-orthanc1:/# Orthanc stop
W0607 06:27:49.323275 main.cpp:1238] Orthanc version: 1.2.0
E0607 06:27:49.326712 OrthancInitialization.cpp:203] Inexistent path to configuration: stop
E0607 06:27:49.326957 main.cpp:1264] Uncaught exception, stopping now: [Inexistent file] (code 13)
W0607 06:27:49.327681 main.cpp:1297] Orthanc has stopped

3.: I can't restart the Orthanc anymore and got this message:

root@jodogne-orthanc1:/# Orthanc ./Configuration.json
W0607 06:27:54.787362 main.cpp:1238] Orthanc version: 1.2.0
W0607 06:27:54.790501 OrthancInitialization.cpp:125] Reading the configuration from: "./Configuration.json"
W0607 06:27:54.793391 FromDcmtkBridge.cpp:141] Loading the external DICOM dictionary "/usr/share/libdcmtk2/dicom.dic"
W0607 06:27:54.811541 FromDcmtkBridge.cpp:141] Loading the external DICOM dictionary "/usr/share/libdcmtk2/private.dic"
W0607 06:27:54.827478 OrthancInitialization.cpp:488] Registering JPEG Lossless codecs
W0607 06:27:54.827613 OrthancInitialization.cpp:493] Registering JPEG codecs
W0607 06:27:54.845340 OrthancInitialization.cpp:986] SQLite index directory: "./OrthancStorage"
W0607 06:27:54.846042 OrthancInitialization.cpp:1056] Storage directory: "./OrthancStorage"
W0607 06:27:54.848015 HttpClient.cpp:685] HTTPS will use the CA certificates from this file: .
W0607 06:27:54.848730 ServerScheduler.cpp:134] The server scheduler has started
W0607 06:27:54.849339 LuaContext.cpp:103] Lua says: Lua toolbox installed
W0607 06:27:54.849526 ServerContext.cpp:181] Disk compression is disabled
W0607 06:27:54.849597 ServerIndex.cpp:1402] No limit on the number of stored patients
W0607 06:27:54.849676 ServerIndex.cpp:1419] No limit on the size of the storage area

E0607 06:27:54.850612 DicomServer.cpp:306] cannot create network: TCP Initialization Error: Address already in use
E0607 06:27:55.850235 main.cpp:1264] Uncaught exception, stopping now: [The TCP port of the DICOM server is privileged or already in use] (code 2004)
W0607 06:27:55.850906 main.cpp:1297] Orthanc has stopped

so cannot create network

4.: I installed python-demjson but for this command got error message again:

root@jodogne-orthanc1:/# jsonlint-py -Sf ./Configuration.json
bash: jsonlint-py: command not found

5.: verbose:

root@jodogne-orthanc1:/# Orthanc ./Configuration.json --verbose
W0607 06:35:46.341379 main.cpp:1238] Orthanc version: 1.2.0
W0607 06:35:46.344628 OrthancInitialization.cpp:125] Reading the configuration from: "./Configuration.json"
W0607 06:35:46.347594 FromDcmtkBridge.cpp:141] Loading the external DICOM dictionary "/usr/share/libdcmtk2/dicom.dic"
W0607 06:35:46.366030 FromDcmtkBridge.cpp:141] Loading the external DICOM dictionary "/usr/share/libdcmtk2/private.dic"
W0607 06:35:46.381160 OrthancInitialization.cpp:488] Registering JPEG Lossless codecs
W0607 06:35:46.381305 OrthancInitialization.cpp:493] Registering JPEG codecs
W0607 06:35:46.398383 OrthancInitialization.cpp:986] SQLite index directory: "./OrthancStorage"
W0607 06:35:46.399047 OrthancInitialization.cpp:1056] Storage directory: "./OrthancStorage"
I0607 06:35:46.400892 DatabaseWrapper.cpp:306] Version of the Orthanc database: 6
W0607 06:35:46.401010 HttpClient.cpp:685] HTTPS will use the CA certificates from this file: .
I0607 06:35:46.401081 HttpClient.cpp:151] Setting the default timeout for HTTP client connections: 10 seconds
I0607 06:35:46.401182 HttpClient.cpp:135] Setting the default proxy for HTTP client connections:
I0607 06:35:46.401237 DicomUserConnection.cpp:1209] Default timeout for DICOM connections if Orthanc acts as SCU (client): 10 seconds (0 = no timeout)
I0607 06:35:46.401843 ServerIndex.cpp:364] Starting the database flushing thread (sleep = 10)
I0607 06:35:46.401857 ServerIndex.cpp:1887] Starting the monitor for stable resources (stable age = 60)
W0607 06:35:46.402041 ServerScheduler.cpp:134] The server scheduler has started
W0607 06:35:46.402521 LuaContext.cpp:103] Lua says: Lua toolbox installed
W0607 06:35:46.402694 ServerContext.cpp:181] Disk compression is disabled
I0607 06:35:46.402862 ServerContext.cpp:495] Storing MD5 for attachments: yes
W0607 06:35:46.402964 ServerIndex.cpp:1402] No limit on the number of stored patients
W0607 06:35:46.403143 ServerIndex.cpp:1419] No limit on the size of the storage area
I0607 06:35:46.403776 DicomServer.cpp:125] Setting timeout for DICOM connections if Orthanc acts as SCP (server): 30 seconds (0 = no timeout)
E0607 06:35:46.404233 DicomServer.cpp:306] cannot create network: TCP Initialization Error: Address already in use
I0607 06:35:47.402054 ServerIndex.cpp:384] Stopping the database flushing thread
I0607 06:35:47.402080 ServerIndex.cpp:1931] Closing the monitor thread for stable resources
E0607 06:35:47.403578 main.cpp:1264] Uncaught exception, stopping now: [The TCP port of the DICOM server is privileged or already in use] (code 2004)
W0607 06:35:47.404084 main.cpp:1297] Orthanc has stopped

6.: trace

root@jodogne-orthanc1:/# Orthanc ./Configuration.json --trace
W0607 06:36:36.579301 main.cpp:1238] Orthanc version: 1.2.0
W0607 06:36:36.582671 OrthancInitialization.cpp:125] Reading the configuration from: "./Configuration.json"
W0607 06:36:36.585831 FromDcmtkBridge.cpp:141] Loading the external DICOM dictionary "/usr/share/libdcmtk2/dicom.dic"
W0607 06:36:36.604374 FromDcmtkBridge.cpp:141] Loading the external DICOM dictionary "/usr/share/libdcmtk2/private.dic"
W0607 06:36:36.619579 OrthancInitialization.cpp:488] Registering JPEG Lossless codecs
W0607 06:36:36.619738 OrthancInitialization.cpp:493] Registering JPEG codecs
W0607 06:36:36.637010 OrthancInitialization.cpp:986] SQLite index directory: "./OrthancStorage"
T0607 06:36:36.637471 Connection.cpp:157] SQLite::Connection::Execute PRAGMA FOREIGN_KEYS=ON;
T0607 06:36:36.637616 Connection.cpp:157] SQLite::Connection::Execute PRAGMA RECURSIVE_TRIGGERS=ON;
W0607 06:36:36.637712 OrthancInitialization.cpp:1056] Storage directory: "./OrthancStorage"
T0607 06:36:36.637947 Connection.cpp:157] SQLite::Connection::Execute PRAGMA ENCODING="UTF-8";
T0607 06:36:36.638043 Connection.cpp:157] SQLite::Connection::Execute PRAGMA SYNCHRONOUS=NORMAL;
T0607 06:36:36.639462 Connection.cpp:157] SQLite::Connection::Execute PRAGMA JOURNAL_MODE=WAL;
T0607 06:36:36.639571 Connection.cpp:157] SQLite::Connection::Execute PRAGMA LOCKING_MODE=EXCLUSIVE;
T0607 06:36:36.639631 Connection.cpp:157] SQLite::Connection::Execute PRAGMA WAL_AUTOCHECKPOINT=1000;
T0607 06:36:36.639781 Statement.cpp:144] SQLite::Statement::Step SELECT name FROM sqlite_master WHERE type=? AND name=?
T0607 06:36:36.640001 Statement.cpp:144] SQLite::Statement::Step SELECT value FROM GlobalProperties WHERE property=?
I0607 06:36:36.640104 DatabaseWrapper.cpp:306] Version of the Orthanc database: 6
W0607 06:36:36.640297 HttpClient.cpp:685] HTTPS will use the CA certificates from this file: .
I0607 06:36:36.640390 HttpClient.cpp:151] Setting the default timeout for HTTP client connections: 10 seconds
I0607 06:36:36.640529 HttpClient.cpp:135] Setting the default proxy for HTTP client connections:
I0607 06:36:36.640605 DicomUserConnection.cpp:1209] Default timeout for DICOM connections if Orthanc acts as SCU (client): 10 seconds (0 = no timeout)
T0607 06:36:36.640986 Statement.cpp:135] SQLite::Statement::Run SELECT SUM(compressedSize) FROM AttachedFiles
T0607 06:36:36.641108 Statement.cpp:135] SQLite::Statement::Run BEGIN TRANSACTION
T0607 06:36:36.641180 Statement.cpp:135] SQLite::Statement::Run COMMIT
I0607 06:36:36.641555 ServerIndex.cpp:1887] Starting the monitor for stable resources (stable age = 60)
T0607 06:36:36.641727 Statement.cpp:144] SQLite::Statement::Step SELECT value FROM GlobalProperties WHERE property=?
I0607 06:36:36.641921 ServerIndex.cpp:364] Starting the database flushing thread (sleep = 10)
W0607 06:36:36.642725 ServerScheduler.cpp:134] The server scheduler has started
W0607 06:36:36.642804 LuaContext.cpp:103] Lua says: Lua toolbox installed
W0607 06:36:36.642939 ServerContext.cpp:181] Disk compression is disabled
I0607 06:36:36.643003 ServerContext.cpp:495] Storing MD5 for attachments: yes
W0607 06:36:36.643069 ServerIndex.cpp:1402] No limit on the number of stored patients
T0607 06:36:36.643116 Statement.cpp:135] SQLite::Statement::Run BEGIN TRANSACTION
T0607 06:36:36.643207 Statement.cpp:135] SQLite::Statement::Run COMMIT
W0607 06:36:36.643292 ServerIndex.cpp:1419] No limit on the size of the storage area
T0607 06:36:36.643342 Statement.cpp:135] SQLite::Statement::Run BEGIN TRANSACTION
T0607 06:36:36.643400 Statement.cpp:135] SQLite::Statement::Run COMMIT
I0607 06:36:36.643977 DicomServer.cpp:125] Setting timeout for DICOM connections if Orthanc acts as SCP (server): 30 seconds (0 = no timeout)
E0607 06:36:36.644337 DicomServer.cpp:306] cannot create network: TCP Initialization Error: Address already in use
I0607 06:36:37.641839 ServerIndex.cpp:1931] Closing the monitor thread for stable resources
I0607 06:36:37.642757 ServerIndex.cpp:384] Stopping the database flushing thread
E0607 06:36:37.644195 main.cpp:1264] Uncaught exception, stopping now: [The TCP port of the DICOM server is privileged or already in use] (code 2004)
W0607 06:36:37.644809 main.cpp:1297] Orthanc has stopped

When I try to mod anything in the /Configuration.json and after it try to start

Orthanc ./Configuration.json

nothing happens. (but shown errors you can see above)

Have you read the error logs you sent us ?
“cannot create network: TCP Initialization Error: Address already in use”

“The TCP port of the DICOM server is privileged or already in use”

What port number do you use ? Ports below 1024 are privileged and might not be accessible on every system
Are you sure there’s no other app already running ?
Maybe an old Orthanc still running ?

I set 4242 ports inside, 11112 outside for dicoms, and 8042 inside and 18080 outside for web.

Are you sure there’s no other app already running using these ports ?
docker ps -a shall list all containers running and ports used

netstat -puta | grep 11112 shall list all apps using port 11112

Hello,

I read fine-tuning-the-configuration, but got some issues:

1.: I can get the copied configuration fileto the / thats ok.

Do you mean on the host or in the container?

If it is on the host, you need to bindmount it using `docker run --
volume ...`. If it is in the container (e.g. you used `docker cp`) you
need to make sure it is copied every time you run it as the topmost
read/write layer is not persistent when you recreate the container
unless you commit it using `docker commit`. Use `docker build` and a
Dockerfile with a COPY directive to simplify the process (create
container, copy file in topmost layer, commit it to create new image
with configuration that you can run).

2.: I can stop Orthanc with this command:

root@jodogne-orthanc1:/# Orthanc stop
W0607 06:27:49.323275 main.cpp:1238] Orthanc version: 1.2.0
E0607 06:27:49.326712 OrthancInitialization.cpp:203] Inexistent path
to configuration: stop
E0607 06:27:49.326957 main.cpp:1264] Uncaught exception, stopping
now: [Inexistent file] (code 13)
W0607 06:27:49.327681 main.cpp:1297] Orthanc has stopped

Is that inside the container? In general you should never need to
control a container using a process inside it (shell or otherwise); in
fact a container is usually just one process.

Please try using the various docker commands from the host.

docker start $container
docker stop $container
docker restart $container
docker run $container
docker rm $container

3.: I can't restart the Orthanc anymore and got this message:

root@jodogne-orthanc1:/# Orthanc ./Configuration.json
W0607 06:27:54.787362 main.cpp:1238] Orthanc version: 1.2.0
W0607 06:27:54.790501 OrthancInitialization.cpp:125] Reading the
configuration from: "./Configuration.json"
W0607 06:27:54.793391 FromDcmtkBridge.cpp:141] Loading the external
DICOM dictionary "/usr/share/libdcmtk2/dicom.dic"
W0607 06:27:54.811541 FromDcmtkBridge.cpp:141] Loading the external
DICOM dictionary "/usr/share/libdcmtk2/private.dic"
W0607 06:27:54.827478 OrthancInitialization.cpp:488] Registering JPEG
Lossless codecs
W0607 06:27:54.827613 OrthancInitialization.cpp:493] Registering JPEG
codecs
W0607 06:27:54.845340 OrthancInitialization.cpp:986] SQLite index
directory: "./OrthancStorage"
W0607 06:27:54.846042 OrthancInitialization.cpp:1056] Storage
directory: "./OrthancStorage"
W0607 06:27:54.848015 HttpClient.cpp:685] HTTPS will use the CA
certificates from this file: .
W0607 06:27:54.848730 ServerScheduler.cpp:134] The server scheduler
has started
W0607 06:27:54.849339 LuaContext.cpp:103] Lua says: Lua toolbox
installed
W0607 06:27:54.849526 ServerContext.cpp:181] Disk compression is
disabled
W0607 06:27:54.849597 ServerIndex.cpp:1402] No limit on the number of
stored patients
W0607 06:27:54.849676 ServerIndex.cpp:1419] No limit on the size of
the storage area

E0607 06:27:54.850612 DicomServer.cpp:306] cannot create network: TCP
Initialization Error: Address already in use
E0607 06:27:55.850235 main.cpp:1264] Uncaught exception, stopping
now: [The TCP port of the DICOM server is privileged or already in
use] (code 2004)
W0607 06:27:55.850906 main.cpp:1297] Orthanc has stopped

Could be TCP TIMEWAIT/socket SO_LINGER, maybe something a little more
obscure related to the virtual network. In any case, try without
manipulating the Orthanc process from within the container as explained
above (Orthanc should be PID1, it doesn't seem like a good idea to try
and restart it from within the container process namespace itself).

4.: I installed python-demjson but for this command got error message
again:

root@jodogne-orthanc1:/# jsonlint-py -Sf ./Configuration.json
bash: jsonlint-py: command not found

Did you install it on the host and are using it inside the container or
vice versa, by any chance? If not, then on a Debian-based system you
can list the contents of a package with `dpkg -L` to figure out the
command name and/or access to documentation. In any case, you shouldn't
need to run it from within the container.

Hope this helps,

Hi,

root@jodogne-orthanc1:/# Orthanc stop
W0607 06:27:49.323275 main.cpp:1238] Orthanc version: 1.2.0
E0607 06:27:49.326712 OrthancInitialization.cpp:203] Inexistent path to configuration: stop
E0607 06:27:49.326957 main.cpp:1264] Uncaught exception, stopping now: [Inexistent file] (code 13)
W0607 06:27:49.327681 main.cpp:1297] Orthanc has stopped

This is not stopping orthanc. (orthanc is run when you start the docker container (and vice versa, when you stop or kill the orthanc process the docker container stops))

When you attach a terminal and try to start orthanc again, it doesn’t work because it is already running on that port and tells you:

E0607 06:27:54.850612 DicomServer.cpp:306] cannot create network: TCP Initialization Error: Address already in use

Also, attaching to the container and changing the configuration in-place is not a very robust solution because those changes will be wiped away when you reset or upgrade the container.

It is better to put the configuration file (and the data directories too) in some directory outside the docker container and link it into the container via volumes (to /etc/orthanc/orthanc.json)
(this is documented in the Orthanc book: http://book.orthanc-server.com/users/docker.html)

$ sudo docker run -p 4242:4242 -p 8042:8042 --rm -v /tmp/orthanc.json:/etc/orthanc/orthanc.json:ro jodogne/orthanc

Here is how to do this with the Synology GUI: https://groups.google.com/d/msg/orthanc-users/oHeShi52vWE/IoNAt8IsDQAJ

–Levin

Hello,

I hereby confirm Levin’s answer, which is exactly what I tried to explain in my previous post: