<p>I went searching for a way to give my <code>docker</code> snap access to the directory, but found a couple of other stackexchange questions that lead me to believe it is not currently possible:</p>
<ul>
<li><a href="https://askubuntu.com/questions/964377/snap-application-doesnt-see-files-from-another-partition">https://askubuntu.com/questions/964377/snap-application-doesnt-see-files-from-another-partition</a></li>
<li><a href="https://askubuntu.com/questions/1033344/how-to-give-snaps-access-to-somedir">https://askubuntu.com/questions/1033344/how-to-give-snaps-access-to-somedir</a></li>
</ul>

CC BY-SA 4.0
2021-10-01T16:14:16.550Z
2021-10-01T16:14:16.550Z
Mutant Bob
<p>Snaps are a layer of isolation, similar to containers, that prevent access to the entire host filesystem. User home directories are mounted into the snaps which gives you access to those folders. If you were to install docker outside of a snap, you should have access to mount other host directories into the container.</p>

CC BY-SA 4.0
2021-09-30T19:43:20.460Z
2021-09-30T19:43:20.460Z
BMitch
<p>I have a data set stashed in <code>/vms1/thoth/new_maplab_shared</code>, but when I</p>
<pre><code>$ docker run -it --mount type=bind,source=/vms1/thoth/new_maplab_shared,target=/new_maplab_shared edd5afa10b5f
docker: Error response from daemon: invalid mount config for type &quot;bind&quot;: bind source path does not exist: /vms1/thoth/new_maplab_shared.
See 'docker run --help'.
$ ls -l /vms1/thoth/new_maplab_shared
total 4148912
-rw-rw-r-- 1 thoth thoth 2673031511 Mar 10  2021 MH_01_easy_ordered.bag
-rw-rw-r-- 1 thoth thoth 1571292346 Mar 10  2021 MH_01_easy.zip
</code></pre>
<p>The directory clearly exists.  If I</p>
<pre><code># mount -o bind /vms1/thoth/new_maplab_shared /home/new_maplab_shared
$ docker run -it --mount type=bind,source=/home/new_maplab_shared,target=/new_maplab_shared edd5afa10b5f
root@5d2bbc6202b1:/# ls /new_maplab_shared/
MH_01_easy.zip  MH_01_easy_ordered.bag
</code></pre>
<p>it works.</p>
<p>What is going on here, and how can I eliminate the bind mount kludge on the host?</p>

CC BY-SA 4.0
2021-09-28T19:04:43.200Z
How are you running docker? Snap?
BMitch
CC BY-SA 4.0
2021-09-30T16:55:17.980Z
`which docker` reports /snap/bin/docker; and `snap list | grep docker` shows I have version 20.10.8
Mutant Bob
<docker>
docker ... invalid mount config for type "bind": bind source path does not exist: but the source path does exist
Mutant Bob
# docker ... invalid mount config for type "bind": bind source path does not exist: but the source path does exist

(Asked by: username_0 on 2021-09-28)

I have a data set stashed in /vms1/thoth/new_maplab_shared, but when I
$ docker run -it --mount type=bind,source=/vms1/thoth/new_maplab_shared,target=/new_maplab_shared edd5afa10b5f
docker: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /vms1/thoth/new_maplab_shared.
See 'docker run --help'.
$ ls -l /vms1/thoth/new_maplab_shared
total 4148912
-rw-rw-r-- 1 thoth thoth 2673031511 Mar 10  2021 MH_01_easy_ordered.bag
-rw-rw-r-- 1 thoth thoth 1571292346 Mar 10  2021 MH_01_easy.zip

The directory clearly exists.  If I
# mount -o bind /vms1/thoth/new_maplab_shared /home/new_maplab_shared
$ docker run -it --mount type=bind,source=/home/new_maplab_shared,target=/new_maplab_shared edd5afa10b5f
root@5d2bbc6202b1:/# ls /new_maplab_shared/
MH_01_easy.zip  MH_01_easy_ordered.bag

it works.
What is going on here, and how can I eliminate the bind mount kludge on the host?

**Tags:** docker

> **Comments:**
> **username_1**: How are you running docker? Snap?  
> **username_0**: `which docker` reports /snap/bin/docker; and `snap list | grep docker` shows I have version 20.10.8  

---

## 2 answers

### Answer by username_1 on 2021-09-30. Score: 3 | Accepted answer

Snaps are a layer of isolation, similar to containers, that prevent access to the entire host filesystem. User home directories are mounted into the snaps which gives you access to those folders. If you were to install docker outside of a snap, you should have access to mount other host directories into the container.


---

### Answer by username_0 on 2021-10-01. Score: 0

I went searching for a way to give my `docker` snap access to the directory, but found a couple of other stackexchange questions that lead me to believe it is not currently possible:

* <https://askubuntu.com/questions/964377/snap-application-doesnt-see-files-from-another-partition>
* <https://askubuntu.com/questions/1033344/how-to-give-snaps-access-to-somedir>


---

