Running dcm4chee on MacOS

Haldun Alımlı
Up&Running
Published in
4 min readMar 17, 2022

What is DICOM?

If you’re into Healthcare IT, you may have heard DICOM standard. In its simplest form, DICOM is a mature standard for management and transfer of medical images along with medical data.

dcm4che: A DICOM Library dedicated to the memory of Che Guevara

What is dcm4che?

dcm4che is a Java library implementation of the DICOM protocol. Hopefully, it is open source and hosted on Github. It’s a very robust implementation of the DICOM standard and many many developers, including me, rely on this great library to develop their Healthcare software.

What is dcm4chee then?

For the careful reader, the title has double-e, dcm4chee. No, it is a not typo. In fact, dcm4che is much more than just a Java library. It includes many utilities and applications in order to test, develop Healthcare applications. The extra ‘e’ in dcm4chee stands for ‘enterprise’. It is a fully working Image Manager/Image Archive application.

Let’s Run dcm4chee

As a Healthcare developer, or an IT professional, you probably need dcm4chee up&running in order to understand the details of the DICOM protocol. dcm4chee has already a well written document on running dcm4chee on Docker. Please check this link. As the title suggests, the article with outline the small details to run dcm4chee on MacOS properly.

  1. Create an user-defined bridge network
docker network create dcm4chee_network

2. We need to create local directories for configuration persistence. I chose ~/.local/dcm4chee-arc/as the root folder under my home directory. We’ll map these folders to our Docker containers soon.

mkdir -p ~/.local/dcm4chee-arc/ldap/ ~/.local/dcm4chee-arc/slapd.d/ ~/.local/dcm4chee-arc/db/ ~/.local/dcm4chee-arc/wildfly/

3. In order to run Docker containers in our current timezone, we’ll map our timezone file. However, unlike Linux, MacOS does not have a timezone file. First check your current timezone.

readlink /etc/localtime | sed ‘s#/var/db/timezone/zoneinfo/##’

4. Create timezone file using below command.

echo $(readlink /etc/localtime | sed ‘s#/var/db/timezone/zoneinfo/##’) > ~/.local/dcm4chee-arc/timezone

5. Check created timezone file.

cat ~/.local/dcm4chee-arc/timezone

6. We’re ready to start OpenLDAP Server. Check the slap.d/ folder after a minute. It’s not empty anymore.

docker run --network=dcm4chee_network --name ldap \
-p 389:389 \
-v ~/.local/dcm4chee-arc/ldap:/var/lib/openldap/openldap-data \
-v ~/.local/dcm4chee-arc/slapd.d:/etc/openldap/slapd.d \
-d dcm4che/slapd-dcm4chee:2.6.0-25.2
$ ls -l ~/.local/dcm4chee-arc/slapd.d
total 8
drwxr-x — — 8 haldun staff 256 Mar 14 16:41 cn=config
-rw — — — — 1 haldun staff 601 Mar 14 16:41 cn=config.ldif

7. Now run PostgresQL database. The db/ folder will have lots of files after startup. If you’ve local PostgresQL running then change the local port to sth. free in your system (e.g. -p 15432:5432).

$ docker run --network=dcm4chee_network --name db \
-p 5432:5432 \
-e POSTGRES_DB=pacsdb \
-e POSTGRES_USER=pacs \
-e POSTGRES_PASSWORD=pacs \
-v /etc/localtime:/etc/localtime:ro \
-v ~/.local/dcm4chee-arc/timezone:/etc/timezone:ro \
-v ~/.local/dcm4chee-arc/db:/var/lib/postgresql/data \
-d dcm4che/postgres-dcm4chee:14.1-25
$ ls -l ~/.local/dcm4chee-arc/db/

8. Finally, run the dcm4che Archive container.

$ docker run --network=dcm4chee_network --name arc \
-p 8080:8080 \
-p 8443:8443 \
-p 9990:9990 \
-p 9993:9993 \
-p 11112:11112 \
-p 2762:2762 \
-p 2575:2575 \
-p 12575:12575 \
-e POSTGRES_DB=pacsdb \
-e POSTGRES_USER=pacs \
-e POSTGRES_PASSWORD=pacs \
-e WILDFLY_WAIT_FOR="ldap:389 db:5432" \
-v /etc/localtime:/etc/localtime:ro \
-v ~/.local/dcm4chee-arc/timezone:/etc/timezone:ro \
-v ~/.local/dcm4chee-arc/wildfly:/opt/wildfly/standalone \
-d dcm4che/dcm4chee-arc-psql:5.25.2
$ ls -l ~/.local/dcm4chee-arc/wildfly
total 0
drwxr-xr-x@ 18 haldun staff 576 Feb 14 17:45 configuration
drwxr-xr-x 4 haldun staff 128 Mar 14 16:45 data
drwxr-xr-x@ 7 haldun staff 224 Mar 14 16:45 deployments
drwxr-xr-x 3 haldun staff 96 Mar 14 16:45 log
drwxr-xr-x 3 haldun staff 96 Mar 14 16:45 tmp
$ tail -f ~/.local/dcm4chee-arc/wildfly/log/server.log

9. Let’s test if everything is on rails. Using dcm4che/dcm4che-tools, send CT images to the Archive.

$ docker run --rm --network=dcm4chee_network dcm4che/dcm4che-tools storescu -cDCM4CHEE@arc:11112 /opt/dcm4che/etc/testdata/dicom

The received images should show up in the UI of the Archive at http://localhost:8080/dcm4chee-arc/ui2 or https://localhost:8443/dcm4chee-arc/ui2

Voila! That’s all. If this article helped you please don’t forget to give a thumbs up. If you faced a problem, please comment below.

--

--