<p>Read the manual please: <a href="https://docs.docker.com/storage/bind-mounts/" rel="nofollow noreferrer">https://docs.docker.com/storage/bind-mounts/</a></p>
<blockquote>
<p><code>-v</code> or <code>--volume</code>: Consists of three fields, separated by colon characters (:). The fields must be in the correct order, and the meaning of each field is not immediately obvious.</p>
<ul>
<li>In the case of bind mounts, the first field is the path to the file or directory on the host machine.</li>
<li>The second field is the path where the file or directory is mounted in the container.</li>
<li>The third field is optional, and is a comma-separated list of options, such as ro, z, and Z. These options are discussed below.</li>
</ul>
</blockquote>
<p>Try</p>
<pre><code>docker run -v /Users/rimo/:/myhome ...
</code></pre>
<p>Also, why are you combining a <code>-it</code> run with an actual command? I thought the <code>-it</code> is to start an interactive shell, which is the opposite of running a single command.</p>

CC BY-SA 4.0
2023-11-07T17:04:13.923Z
Thanks for your response! Didn't see it until I posted my answer below but it definitely makes sense. I'm still trying to figure out how Docker works so your comment about `-it` and what it actually means helped!
rimo
CC BY-SA 4.0
2023-11-06T21:03:51.473Z
2023-11-06T21:03:51.473Z
Ram RS
<p>I went back to the documentation listed on the GATK website instead of Docker because the Docker documentation was a bit confusing. And was able to figure it out with this command:</p>
<pre><code>docker run -v ~/data:/gatk/my_data -it broadinstitute/gatk:latest
</code></pre>
<p>And for those who might use this as a resource because they don't understand how to use local files on a Docker image the breakdown is as follows:</p>
<ul>
<li>~/data = path where the data is located on the local machine</li>
<li>/gatk/my_data = path where the data will be located on the Docker image (folder will be created when the command is executed)</li>
<li>this link saved me: <a href="https://gatk.broadinstitute.org/hc/en-us/articles/360035889991" rel="nofollow noreferrer">https://gatk.broadinstitute.org/hc/en-us/articles/360035889991</a></li>
</ul>

CC BY-SA 4.0
2023-11-07T16:59:23.697Z
Upvoting @RamRS would be a cool thing to do.
M__
CC BY-SA 4.0
2023-11-07T17:08:41.043Z
The main issue here was that I didn't understand the breakdown of a `docker run` command and the documentation on the website is pretty confusing if you aren't familiar with all of the verbiage. Going back and breaking down the command helped me understand how the local files on my computer get onto the docker image and where to find them in order to run a separate command. I got there in the end but thanks for your contribution!
rimo
CC BY-SA 4.0
2023-11-06T22:38:03.423Z
2023-11-06T22:38:03.423Z
rimo
<p>I'm trying to use the HaplotypeCaller from the GATK toolkit but I keep getting an error. I pulled GATK through Docker and am using this command:</p>
<pre><code>docker run -v /Users/rimo/ -it broadinstitute/gatk:latest gatk HaplotypeCaller -R /Users/rimo/reference.fasta -I /Users/rimo/sample1.bam -O /Users/rimo/sample1.g.vcf.gz -ERC GVCF
</code></pre>
<p><code>/Users/rimo</code> is my home directory it's where the files are currently located on my computer and it's where I want GATK to look for files to use in the command.</p>
<p>but then I get this error:</p>
<pre><code>A USER ERROR has occurred: The specified fasta file (file:///Users/rimo/reference.fasta) does not exist.
</code></pre>
<p>I don't fully understand how Docker commands work but I found a similar problem listed with this <a href="https://bioinformatics.stackexchange.com/questions/21426/importing-local-files-to-a-gatk-docker-image">issue</a>. I tried to use their solution but it's still giving me the same error as listed above.</p>

<variant-calling><gatk><docker><command-line><troubleshooting>
How to run a GATK Docker Image with local files?
# How to run a GATK Docker Image with local files?

(Asked by: username_0 on 2023-11-06)

I'm trying to use the HaplotypeCaller from the GATK toolkit but I keep getting an error. I pulled GATK through Docker and am using this command:
docker run -v /Users/rimo/ -it broadinstitute/gatk:latest gatk HaplotypeCaller -R /Users/rimo/reference.fasta -I /Users/rimo/sample1.bam -O /Users/rimo/sample1.g.vcf.gz -ERC GVCF

/Users/rimo is my home directory it's where the files are currently located on my computer and it's where I want GATK to look for files to use in the command.
but then I get this error:
A USER ERROR has occurred: The specified fasta file (file:///Users/rimo/reference.fasta) does not exist.

I don't fully understand how Docker commands work but I found a similar problem listed with this issue. I tried to use their solution but it's still giving me the same error as listed above.

**Tags:** variant-calling, gatk, docker, command-line, troubleshooting

---

## 2 answers

### Answer by username_1 on 2023-11-06. Score: 3

Read the manual please: https://docs.docker.com/storage/bind-mounts/

-v or --volume: Consists of three fields, separated by colon characters (:). The fields must be in the correct order, and the meaning of each field is not immediately obvious.

In the case of bind mounts, the first field is the path to the file or directory on the host machine.
The second field is the path where the file or directory is mounted in the container.
The third field is optional, and is a comma-separated list of options, such as ro, z, and Z. These options are discussed below.


Try
docker run -v /Users/rimo/:/myhome ...

Also, why are you combining a -it run with an actual command? I thought the -it is to start an interactive shell, which is the opposite of running a single command.

> **Comments:**
> **username_0**: Thanks for your response! Didn't see it until I posted my answer below but it definitely makes sense. I'm still trying to figure out how Docker works so your comment about `-it` and what it actually means helped!  

---

### Answer by username_0 on 2023-11-06. Score: 2

I went back to the documentation listed on the GATK website instead of Docker because the Docker documentation was a bit confusing. And was able to figure it out with this command:
docker run -v ~/data:/gatk/my_data -it broadinstitute/gatk:latest

And for those who might use this as a resource because they don't understand how to use local files on a Docker image the breakdown is as follows:

~/data = path where the data is located on the local machine
/gatk/my_data = path where the data will be located on the Docker image (folder will be created when the command is executed)
this link saved me: https://gatk.broadinstitute.org/hc/en-us/articles/360035889991

> **Comments:**
> **username_2**: Upvoting @RamRS would be a cool thing to do.  
> **username_0**: The main issue here was that I didn't understand the breakdown of a `docker run` command and the documentation on the website is pretty confusing if you aren't familiar with all of the verbiage. Going back and breaking down the command helped me understand how the local files on my computer get onto the docker image and where to find them in order to run a separate command. I got there in the end but thanks for your contribution!  

---

