No commands in Docker container service image

26 views
Skip to first unread message

Martin Craig

unread,
Nov 16, 2021, 8:58:02 AM11/16/21
to xnat_di...@googlegroups.com
Hi, I'm building Docker images that contain XNAT commands, but when I pull the image into XNAT it hides the image because it cannot detect any commands.

I can add the command JSON manually and it works, but the embedded label is not being picked up. This is what I see in 'docker image inspect':

            "Labels": {
                "org.nrg.commands": "[{\"name\": \"ukat_t2star\", \"command-line\": \"python ukat_t2star.py /input /output [METHOD]\", \"image\": \"martincraig/ukat\", \"label\": \"ukat_t2star\", \"version\": \"0.0.1\", \"schema-version\": \"1.0\", \"info-url\": \"\", \"type\": \"docker\", \"description\": \"Runs UKAT T2* mapping\", \"inputs\": [{\"name\": \"method\", \"replacement-key\": \"[METHOD]\", \"required\": false, \"type\": \"string\", \"default-value\": \"loglin\", \"description\": \"Method for calculating T2* - loglin or 2p_exp\"}], \"outputs\": [{\"mount\": \"ukat-out\", \"required\": \"true\", \"name\": \"t2star\", \"description\": \"T2* map\"}], \"mounts\": [{\"writable\": \"false\", \"path\": \"/input\", \"name\": \"nifti-in\"}, {\"writable\": \"true\", \"path\": \"/output\", \"name\": \"ukat-out\"}], \"xnat\": [{\"derived-inputs\": [{\"name\": \"scan-niftis\", \"matcher\": \"@.label == 'NIFTI'\", \"provides-files-for-command-mount\": \"nifti-in\", \"derived-from-wrapper-input\": \"scan\", \"type\": \"Resource\", \"description\": \"The nifti resource on the scan\"}], \"contexts\": [\"xnat:imageScanData\"], \"description\": \"Run UKAT T2* mapping\", \"label\": \"ukat_t2star\", \"output-handlers\": [{\"accepts-command-output\": \"t2star\", \"label\": \"T2STAR\", \"type\": \"Resource\", \"name\": \"t2star-resource\", \"as-a-child-of-wrapper-input\": \"scan\"}], \"external-inputs\": [{\"matcher\": \"'NIFTI' in @.resources[*].label\", \"required\": true, \"type\": \"Scan\", \"name\": \"scan\", \"description\": \"Input scan\"}], \"name\": \"ukat_t2star-scan\"}]}, \t{\"name\": \"ukat_b0\", \"command-line\": \"python ukat_b0.py /input /output [METHOD]\", \"image\": \"martincraig/ukat\", \"label\": \"ukat_b0\", \"version\": \"0.0.1\", \"schema-version\": \"1.0\", \"info-url\": \"\", \"type\": \"docker\", \"description\": \"Runs UKAT B0 mapping\", \"inputs\": [], \"outputs\": [{\"mount\": \"ukat-out\", \"required\": \"true\", \"name\": \"b0\", \"description\": \"B0 maps\"}], \"mounts\": [{\"writable\": \"false\", \"path\": \"/input\", \"name\": \"nifti-in\"}, {\"writable\": \"true\", \"path\": \"/output\", \"name\": \"ukat-out\"}], \"xnat\": [{\"derived-inputs\": [{\"name\": \"scan-niftis\", \"matcher\": \"@.label == 'NIFTI'\", \"provides-files-for-command-mount\": \"nifti-in\", \"derived-from-wrapper-input\": \"scan\", \"type\": \"Resource\", \"description\": \"The nifti resource on the scan\"}], \"contexts\": [\"xnat:imageScanData\"], \"description\": \"Run UKAT B0 mapping\", \"label\": \"ukat_b0\", \"output-handlers\": [{\"accepts-command-output\": \"b0\", \"label\": \"B0\", \"type\": \"Resource\", \"name\": \"b0-resource\", \"as-a-child-of-wrapper-input\": \"scan\"}], \"external-inputs\": [{\"matcher\": \"'NIFTI' in @.resources[*].label\", \"required\": true, \"type\": \"Scan\", \"name\": \"scan\", \"description\": \"Input scan\"}], \"name\": \"ukat_b0-scan\"}]}]"
            }

This is generated using cmd2label.py directly from the same json I have used successfully with the manual method.

Any ideas what might be going wrong here? I can't see anything in the XNAT logs.

Thanks for any help,
Martin

kel...@wustl.edu

unread,
Nov 16, 2021, 1:26:33 PM11/16/21
to xnat_discussion
Hi Martin,
The embedded label is deserialized using a slightly different path than the manually entered command, so some escaped special characters can cause issues. Can you share your non-escaped command JSON?  Also, which version of XNAT and Container Service are you using?

Thanks,
Matt

Martin Craig

unread,
Nov 18, 2021, 5:25:58 AM11/18/21
to xnat_di...@googlegroups.com
Sure, below is the non-escaped version - there are two commands:

I am running XNAT 1.8.2 build 3 however we have had similar issues on 1.7.5.6, build: 1651. Strangely after adding the commands manually we often find two copies of each command available to be enabled. I'm not sure if this is connected, in each case one copy appears to be  attached to the Docker Hub image and another to the local copy of the image (see below):

Screenshot 2021-11-18 at 10.25.11.png
Thanks,
Martin

{
    ]
}


{
    ]
}


--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/b1a670ea-550e-43dc-809e-938d48aec01dn%40googlegroups.com.

angel.m...@gmail.com

unread,
Dec 2, 2021, 7:30:02 PM12/2/21
to xnat_discussion
I'm having this issue as well. I can add the command manually but it's not being picked up from the docker image.

kel...@wustl.edu

unread,
Dec 9, 2021, 12:05:10 PM12/9/21
to xnat_discussion
I'm not convinced, but I wonder if this has to do with the missing tag specification in your image specification - i.e. "image": "martincraig/ukat" should be "image": "martincraig/ukat:0.0.3".

I'll share an example build directory using your commands and a dummy Dockerfile.base file (which would need to be edited according to your needs). I'm using the ./build.sh script, followed by 'docker push martincraig/ukat:0.0.0' to create an image with successfully imports its commands into my XNAT.

Let me know if this works for you.

Best,
Matt

ukat.zip
Reply all
Reply to author
Forward
0 new messages