Freesurfer cannot open nifti in Docker

Dear experts,

I’m an amateur when it comes to docker, I haven’t had much experience so please excuse me.
I have been trying to install FreeSurfer on my local Windows computer for a while, after failing to run this through a virtual machine I’m trying my luck through the docker version.
As you know, FreeSurfer will not work without a license so when I just run:
docker run freesurfer/freesurfer:7.3.1 mri_convert [input file] [output file]

it gives me the following error (and rightly so):

ERROR: FreeSurfer license file /usr/local/freesurfer/.license not found.
  If you are outside the NMR-Martinos Center,
  go to http://surfer.nmr.mgh.harvard.edu/registration.html to
  get a valid license file (it's free).
  If you are inside the NMR-Martinos Center,
  make sure to source the standard environment.
  A path to an alternative license file can also be
  specified with the FS_LICENSE environmental variable.

I have followed the instructions here and here to mount the license file but for some reason, I keep getting this error.

docker run -it --rm \ -v .\license.txt:/license.txt:ro \ -e FS_LICENSE=.\license.txt \ freesurfer/freesurfer:7.3.1 \ mri_convert [input .nii file] [output .mgz file]
docker: invalid reference format.
See 'docker run --help'.

I know this is probably very intuitive but I would appreciate it if someone could tell me what I’m doing wrong. All the posts on here relating to freesurfer and license issues on docker point to fMRIprep which I’m not using. This is just the standard Freesurfer docker.

Any help is appreciated.
Thank you.

Update: I have managed to make the license work but now there’s a new error when running mri_convert :(((((

docker run -it --rm -v C:/Users/tahit/Downloads/license.txt:/license.txt:ro -e FS_LICENSE='/license.txt' freesurfer/freesurfer:7.3.1 mri_convert C:\Users\tahit\Downloads\mni.nii.gz C:\Users\tahit\Downloads\trial.mgz
mri_convert C:\Users\tahit\Downloads\mni.nii.gz C:\Users\tahit\Downloads\trial.mgz
reading from C:\Users\tahit\Downloads\mni.nii.gz...
error: niiRead(): error opening file /root/C:\Users\tahit\Downloads\mni.nii.gz

Just trialling it on a standard MNI nifti and not sure why it can’t read it? The path file is correct I have even tried listing it and dragging and dropping the file…

Hi @aa23,

Windows can be weird sometimes… you may have better luck using a Unix-like shell for Windows, such as Cygwin. That way you don’t have to worry about paths being weird due to backslashes vs. forward slashes.

Best,
Steven

Dear @aa23 ,

Have you had a look at www.neurodesk.org - It makes running Neuroimaging software very easy and it comes with freesurfer :slight_smile:

Cheers
Steffen