title: How to Run a Command in a Container Using Local Input Files without Copying
body: <p>I am new to docker and containers. I have a container consisting of an MRI analysis software. Within this container are many other software the main software draws its commands from. I would like to run a single command from one of the softwares in this container using research data that is located on an external hard drive which is plugged into my local machine that is running docker.</p>
  
  <p>I know there is a <code>cp</code> command for copying files (such as scripts) into containers and most other questions along these lines seem to recommend copying the files from your local machine into the container and then running the script (or whatever) from the container. In my case I need the container to access data from separate folders in a directory structure and copying over the entire directory is not feasible since it is quite large.</p>
  
  <p>I honestly just want to know how I can run a single command inside the docker using inputs present on my local machine. I have run <code>docker ps</code> to get the <code>CONTAINER_ID</code> which is d8dbcf705ee7. Having looked into executing commands inside containers I tried the following command:</p>
  
  <p><code>docker exec d8dbcf705ee7 /bin/bash -c "mcflirt -in /Volumes/DISS/FMRIPREP/sub-S06V1A/func/sub-S06V1A_task-compound_run-01_bold.nii -out sub-S06V1A_task-compound_run-01_bold_mcf_COMMAND_TEST.nii.gz -reffile /Volumes/DISS/FMRIPREP_TMP/sub-S06V1A_dof6_ver1.2.5/fmriprep_wf/single_subject_S06V1A_wf/func_preproc_task_compound_run_01_wf/bold_reference_wf/gen_ref/ref_image.nii.gz -mats -plots"</code></p>
  
  <p><code>mcflirt</code> is the command I want to run inside the container. I believe the <code>exec</code> command would do what I hope since if I run <code>docker exec d8dbcf705ee7 /bin/bash -c "mcflirt"</code> I will get help output for the <code>mcflirt</code> command which is the expected outcome in that case. The files inside of the <code>/Volume/...</code> paths are the files on my local machine I would like to access. I understand that the location of the files is the problem since I cannot tab complete the paths within this command; when I run this I get the following output:</p>
  
  <p><code>Image Exception : #22 :: ERROR: Could not open image /Volumes/DISS/FMRIPREP/sub-S06V1A/func/sub-S06V1A_task-compound_run-01_bold
  terminate called after throwing an instance of 'RBD_COMMON::BaseException'</code></p>
  
  <p>Can anyone point me in the right direction?</p>