Problems getting docker plugin dcm2bids-session to work in XNAT 1.7

Hi there!

I’ve got an instance of XNAT 1.7 running on a server and I have configured a docker image plugin for dcm2bids (github) and installed the docker image on the server (by doing “docker pull xnat/dcm2bids-session”). I’ve also automatised the launching of the command for when a session is archived (SessionArchived event)

The problem is every time I upload a new subject, the image gets launched but it fails.

The command-line command looks like this:

python --session XNAT_E00011 --overwrite False --host $XNAT_HOST --user $XNAT_USER --pass $XNAT_PASS --upload-by-ref False --dicomdir /dicom --niftidir /nifti

The contents of StdOut.log are:

Making DICOM directory /dicom
Making NIFTI image directory /nifti/IMG
Making NIFTI BIDS directory /nifti/BIDS
Get project and subject ID for session ID XNAT_E00011.
Request Failed
HTTPSConnectionPool(host='$xnat_host', port=443): Max retries exceeded with url: /data/experiments XNAT_E00011?handler=values&columns=project%2Csubject_ID&format=json (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -2] Name or service not known',))

And the enviromental variables look as follows:


I have the impression that the problem is that the host is not being prepended in the URL the images uses to query the project and subject ID. I also noted that the host variable in the HTTPSConnectionPool request looks like $xnat_host (in lowercase) and that the port is 443 instead of 8080. What might I be doing wrong? Do I have to somehow configure the host and port so they get correctly filled out in the python script?

Thanks a lot!

For the record. I got a solution from the XNAT forum discussion.

The solution is to make sure that in the command definition (Administer > Plugin settings > Images and Commands > find actual command > Edit Command) the property “override-entrypoint” is set to “true” (with no quotes). That property is supposed to tell docker to execute your command through a shell interpreter, which would handle the environment variable expansion.

1 Like

Hi @stefanpsz ,

There is a brand new dcm2bids version if you want to take a look. There is also a dcm2bids docker.

Can you tag your thread as solved ? It helps us sort all threads. Thank you in advance