大数据

Centos Docker环境下安装Dcm4che归档服务

2018-03-25  本文已影响636人  溯水心生

本文实现了搭建一个最小的基于Dcm4che+Docker的归档服务,能够实现影像DICOM的归档,调阅,转发功能,其搭建参考于GitHub 开源项目说明:dcm4che/dcm4chee-arc-light

$ sudo -i
# groupadd -r slapd-dcm4chee --gid=1021 && useradd -r -g slapd-dcm4chee --uid=1021 slapd-dcm4chee
# groupadd -r postgres-dcm4chee --gid=999 && useradd -r -g postgres-dcm4chee --uid=999 postgres-dcm4chee
# groupadd -r dcm4chee-arc --gid=1023 && useradd -r -g dcm4chee-arc --uid=1023 dcm4chee-arc
# exit
DOCKER 归档模块示意图

1.创建一个docker默认桥接网络

$ docker network create dcm4chee_default

2.开启OpenLDAP Server

 docker run --network=dcm4chee_default --name ldap \
           -p 389:389 \
           -v /etc/localtime:/etc/localtime:ro \
           -v /var/local/dcm4chee-arc/ldap:/var/lib/ldap \
           -v /var/local/dcm4chee-arc/slapd.d:/etc/ldap/slapd.d \
           -d dcm4che/slapd-dcm4chee:2.4.44-12.0

此命令会优先查找镜像,如本地无镜像,则去docker中心下载进行并按参数运行容器。

参数说明:

-e LDAP_BASE_DN=dc=ihe,dc=net \
-e LDAP_ROOTPASS=mypass \
-e ARCHIVE_DEVICE_NAME=central-archive \
-e AE_TITLE=CENTRAL \
-e ARCHIVE_HOST=central-archive \
-e DICOM_PORT=10104 \
-e HL7_PORT=12575
-e STORAGE_DIR=/storage/fs1

此处移除了官方的时间时区绑定参数

-v /etc/timezone:/etc/timezone:ro

,因为在Centos,此参数回到如下错误,即时区绑定问题:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/etc/timezone\\\" to rootfs \\\"/var/lib/docker/overlay2/0aea67b9ced0e403f88d6e2185f93848c3810c8ff5f5052811225b13d8611731/merged\\\" at \\\"/var/lib/docker/overlay2/0aea67b9ced0e403f88d6e2185f93848c3810c8ff5f5052811225b13d8611731/merged/etc/timezone\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

3.开启PostGres DB 实例

docker run --network=dcm4chee_default --name db \
           -p 5432:5432 \
           -e POSTGRES_DB=pacsdb \
           -e POSTGRES_USER=pacs \
           -e POSTGRES_PASSWORD=pacs \
           -v /etc/localtime:/etc/localtime:ro \
           -v /var/local/dcm4chee-arc/db:/var/lib/postgresql/data \
           -d dcm4che/postgres-dcm4chee:10.0-12

此命令创建一个名为db 的PostGres数据库实例,参数说明如下:

tips:

如果无法开启容器服务,请手动查找占用端口情况,查询端口占用命令如下:

[root@localhost ~]# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      2417/mysqld         
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      4181/nginx: master  
tcp        0      0 127.0.0.1:5941          0.0.0.0:*               LISTEN      2681/teamviewerd    
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      3133/dnsmasq        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1027/sshd           
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1026/cupsd          
tcp        0      0 127.0.0.1:5432          0.0.0.0:*               LISTEN      1608/postmaster     
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2195/master         
tcp        0      0 127.0.0.1:32000         0.0.0.0:*               LISTEN      3651/java           
tcp        0      0 127.0.0.1:32001         0.0.0.0:*               LISTEN      3666/java           
tcp        0      0 127.0.0.1:32002         0.0.0.0:*               LISTEN      3702/java           
tcp        0      0 127.0.0.1:32003         0.0.0.0:*               LISTEN      3744/java           
tcp        0      0 127.0.0.1:32004         0.0.0.0:*               LISTEN      3745/java           
tcp        0      0 127.0.0.1:32005         0.0.0.0:*               LISTEN      3743/java           
tcp6       0      0 192.168.43.50:11111     :::*                    LISTEN      3666/java           
tcp6       0      0 192.168.43.50:11113     :::*                    LISTEN      3702/java           
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
tcp6       0      0 :::22                   :::*                    LISTEN      1027/sshd           
tcp6       0      0 ::1:631                 :::*                    LISTEN      1026/cupsd          
tcp6       0      0 ::1:5432                :::*                    LISTEN      1608/postmaster     
tcp6       0      0 ::1:25                  :::*                    LISTEN      2195/master         
tcp6       0      0 :::389                  :::*                    LISTEN      18444/docker-proxy  

可以看到 5432 TCP端口已被占用,强制干掉占用端口进程,后重新启动容器

[root@localhost ~]# kill -9 1608
[root@localhost ~]# docker start db
db

此时容器正常启动且可以通过工具访问PostGres数据库了。

4.使用已部署的dcm4che Archive 5应用程序启动Wildfly

将已部署的dcm4che Archive 5应用程序提供Wildfly的容器启动到创建的网络中,例如:

docker run --network=dcm4chee_default --name arc \
           -p 8080:8080 \
           -p 8443:8443 \
           -p 9990:9990 \
           -p 11112:11112 \
           -p 2575:2575 \
           -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 /var/local/dcm4chee-arc/wildfly:/opt/wildfly/standalone \
           -d dcm4che/dcm4chee-arc-psql:5.12.0

参数说明如下:

-p 8080:8080 \
-p 8443:8443 \
-p 9990:9990 \
-p 11112:11112 \
-p 2575:2575 \

将Web服务器的http(8080)和https(8443)端口以及9990WildFly管理控制台的http端口(11112)和2575存档应用程序的DICOM和HL7端口从容器发布到主机,以启用外部https客户端,DICOM应用程序和HL7发件人连接到WildFly和Archive应用程序。
环境变量:

-e POSTGRES_DB=pacsdb \
-e POSTGRES_USER=pacs \
-e POSTGRES_PASSWORD=pacs \

设置数据库名称,用户及其密码以连接到PostgreSQL服务器,这些服务器必须与为PostgreSQL服务器容器指定的值相匹配。否则,存档应用程序将无法连接到PostgreSQL服务器。

如果您设置环境变量LDAP_BASE_DN,LDAP_ROOTPASS或ARCHIVE_DEVICE_NAMELDAP服务器容器,你必须设置环境变量也为存档容器。否则,存档应用程序将无法连接到LDAP服务器,或者无法在LDAP目录中找到其配置。

-e WILDFLY_WAIT_FOR="ldap:389 db:5432" 延迟WildFly的启动,直到OpenLDAP slapd和PostgreSQL在指定端口上侦听,这样可以防止在OpenLDAP slapd和PostgreSQL准备好接受连接之前由于归档应用程序连接到LDAP和PostgreSQL失败而导致所有容器重新启动时出错。

绑定安装-v /var/local/dcm4chee-arc/wildfly:/opt/wildfly/standalone需要注意将Wildfly服务器配置存储在指定的主机目录中。它在第一个容器启动时初始化,如果它尚未存在于指定的主机目录中。这可确保在删除和重新创建Archive Server容器时数据不会丢失。

如果存档成功启动,请检查宿主机Wildfly服务器日志:

$ tail -f /var/local/dcm4chee-arc/wildfly/log/server.log 
2017-09-03 20:34:38,934 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 64) WFLYUT0021: Registered web context: /dcm4chee-arc
2017-09-03 20:34:38,934 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 73) WFLYUT0021: Registered web context: /dcm4chee-arc/ui2
2017-09-03 20:34:38,934 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 81) WFLYUT0021: Registered web context: /dcm4chee-arc/xdsi
2017-09-03 20:34:39,219 INFO  [org.dcm4che3.net.Connection] (EE-ManagedExecutorService-default-Thread-1) Start TCP Listener on /0.0.0.0:2575
2017-09-03 20:34:39,219 INFO  [org.dcm4che3.net.Connection] (EE-ManagedExecutorService-default-Thread-2) Start TCP Listener on /0.0.0.0:11112
2017-09-03 20:34:39,253 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: Deployed "dcm4chee-arc-ear-5.12.0-psql.ear" (runtime-name : "dcm4chee-arc-ear-5.12.0-psql.ear")
2017-09-03 20:34:39,399 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://0.0.0.0:9990/management
2017-09-03 20:34:39,399 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://0.0.0.0:9990
2017-09-03 20:34:39,399 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 9354ms - Started 2464 of 2849 services (647 services are lazy, passive or on-demand)

5.使用dcmTools工具进行发图测试

docker run --rm --network=dcm4chee_default dcm4che/dcm4che-tools:5.10.5 storescu -c DCM4CHEE@arc:11112 /opt/dcm4che/etc/testdata/dicom

你也可以通过其他发图工具如Efilm workStation,dcm4che 工具进行发图测试,
值的说明的是docker启动的默认参数如下:

AETtile:DCM4CHE
Port:11112
IP:docker 容器IP[本实例为docker创建的arc 容器IP]

访问地址:http://192.168.43.50:8080/dcm4chee-arc/ui2/#/studies

发图成功后,访问DICOM归档管理界面,截图如下:


归档截图

到这一步就完成了所有的归档服务的搭建,是不是很简答呐!

备注信息
Web Service URLs

Archive UI: http://<docker-host>:8080/dcm4chee-arc/ui2 - if secured, login with
Username Password Role
user user user
admin admin user + admin
Wildfly Administration Console: http://<docker-host>:9990, login with Username: admin, Password: admin.

DICOM QIDO-RS Base URL: http://<docker-host>:8080/dcm4chee-arc/aets/DCM4CHEE/rs

DICOM STOW-RS Base URL: http://<docker-host>:8080/dcm4chee-arc/aets/DCM4CHEE/rs

DICOM WADO-RS Base URL: http://<docker-host>:8080/dcm4chee-arc/aets/DCM4CHEE/rs

DICOM WADO-URI: http://<docker-host>:8080/dcm4chee-arc/aets/DCM4CHEE/wado

IHE XDS-I Retrieve Imaging Document Set: http://<docker-host>:8080/dcm4chee-arc/xdsi/ImagingDocumentSource

6.停止服务和容器

# docker kill arc
# docker kill ldap
# docker kill db
上一篇下一篇

猜你喜欢

热点阅读