Sign inSign up

opendicom/dicomtools

By opendicom

•Updated 7 months ago

Image
0

410

opendicom/dicomtools repository overview

⁠Docker DICOM Tools

Docker image with DICOM toolchains https://github.com/opendicom/docker-dicomtools⁠

This repository provides a lightweight, repeatable Docker image that bundles common DICOM command-line utilities in a single place. It is useful for automation tasks like inspecting or transforming DICOM files, scripting maintenance jobs, and running scheduled workflows in a container.

The image is designed to work well in “container-native” environments:

  • It can run scheduled jobs in the foreground (so you can see logs via docker logs).
  • It can also be started with a custom command/script (overriding the default CMD) for one-off tasks or long-running custom processes.

See the examples/ folder for ready-to-run scripts, a sample crontab, and docker compose files.

Includes (see Dockerfile for exact versions):

  • DCMTK
  • dcm4che2 and dcm4che5
  • Grok (JPEG 2000 codec)
  • Saxon-B
  • supercronic (cron runner for containers)

⁠Cron (foreground + logs)

This image runs scheduled jobs using supercronic (a cron runner designed for containers).

  • The container keeps running in foreground.
  • Job output (stdout/stderr) is printed to the container logs.
  • Jobs are read from /crontab_file.

The default container command is equivalent to:

supercronic -passthrough-logs /crontab_file

To use it, mount a crontab file to /crontab_file and your scripts to /opt/scripts.

⁠Quick test (using the provided examples)
  1. Build the image from this repo:
docker build -t opendicom/dicomtools:local .
  1. Ensure the example script is executable (important when bind-mounting from Linux):
chmod +x examples/scripts/hello.sh
  1. Run the container in foreground (it will keep running):
docker run --rm --name dicomtools-cron \
    -e TEST_VAR="hello" \
    -v "$PWD/examples/crontab_file:/crontab_file:ro" \
    -v "$PWD/examples/scripts:/opt/scripts:ro" \
    opendicom/dicomtools:local
  1. In another terminal, follow the logs (you should see a line every minute):
docker logs -f dicomtools-cron

You should see TEST_VAR=hello in the job output.

⁠Quick test with docker compose

This repo includes ready-to-use compose files under examples/.

Build the image first (or edit the compose files to use build: ..).

Run the cron example:

cd examples
docker compose up

Stop it with:

docker compose down

To follow logs in another terminal:

docker logs -f dicomtools-cron

If you prefer a faster feedback loop, temporarily change the schedule in examples/crontab_file to run more frequently.

Example crontab_file:

SHELL=/bin/bash

# All environment variables from the container are inherited by jobs.
# (So PATH set via Dockerfile ENV or `docker run -e ...` is available.)

* * * * * /opt/scripts/hello.sh

Note: avoid redirecting output to files if you want to see it in docker logs.

⁠Running a custom script instead of supercronic

By default, the image starts with supercronic (see CMD in the Dockerfile). If you want to run an external script instead, you can override the container command in docker-compose.yml.

⁠Using the provided compose example

Run the command override example:

cd examples
docker compose -f docker-compose-cmd.yml up

Example docker-compose.yml:

services:
    dicomtools:
        image: opendicom/dicomtools:local
        # or: build: .
        environment:
            TEST_VAR: "hola"
        volumes:
            - ./my-script.sh:/opt/scripts/my-script.sh:ro
        command: ["/bin/bash", "-lc", "/opt/scripts/my-script.sh"]

Notes:

  • command: replaces the Dockerfile CMD.
  • If you want the container to stay up, your script must keep running (or tail logs, etc.).
  • If the script is not executable on the host, running it via bash -lc still works.

Tag summary

Content type

Image

Digest

sha256:295baf103…

Size

500.1 MB

Last updated

7 months ago

docker pull opendicom/dicomtools