Page tree
Skip to end of metadata
Go to start of metadata

One of the features of the container service is that you can write the command wrapper in such a way that XNAT data will be mounted into a container when it is launched. You do this by first defining a mount in the command. Then in the wrapper, you can have an input which is of some XNAT type that provides files (like a Session, or a Scan, or a Resource, etc.); in that input you set the property provides-files-to-command-mount to the name of the mount.


One of the requirements to make this work is that the XNAT archive and build spaces need to be present where XNAT runs and also where the docker jobs are executed (if they are not the same machine). But sometimes you can have the same files in both places, but they aren't at the same path. For instance, you might have an NFS mount at /data/xnat/archive on the XNAT machine, but at /mounts/xnat01/archive on the machine where docker runs jobs. Or maybe you run XNAT through docker on your host machine, perhaps using the xnat-docker-compose project. In that case you would have XNAT running in a container with the data at /data/xnat/archive but on the host machine at something like /Users/me/xnat-docker-compose/xnat-data/archive. In these cases, the path where XNAT sees the data will not be the same as where docker sees the data on the other machine. This causes a problem when mounting data, because XNAT will give docker a path to mount, but that path will not exist when docker goes to mount it.

The solution is to set the Path Translation property on your docker server settings in the container service. This allows you to tell the container service a path prefix it can swap out when doing the mounts. In the examples above, you would set the XNAT Path Prefix property to "/data/xnat" and the Docker Server Path Prefix to whatever the equivalent path is on the docker machine, such as "/Users/me/xnat-docker-compose/xnat-data". When the container service asks XNAT for the path to some data, it will substitute the XNAT prefix for the Docker prefix before it tells docker the path to mount.

  • No labels