Incorrect behaviour with bind mounts outside of snap allowed paths #245
Replies: 3 comments
-
|
Ideally, this would error out with some kind of error like |
Beta Was this translation helpful? Give feedback.
-
|
+1 I've just spent a few hours trying to work out why my docker mounts pointing to /media were working but data in other volumes was disappearing when restarting the machine. Using --volume to define a volume (or the equivalent syntax on compose) caused the directories to be created silently (I've now switched over to the --mount syntax but it didnt help with this issue as I still would not have been able to easily work out why docker couldnt see my created directory) Portainer in host mode can "see" the newly created directories in / and the docker container has no problem with using them. Like the OP I also tried to use find to Its not easy to work out what has gone wrong here, on the surface everything looks fine. I was previously using the apt version of docker, and the same compose files were working with no issue. I believe the snap version of docker was installed during the OOBE when reinstalling ubuntu server. For anyone who finds this, the list of allowed directories are in here: https://github.com/canonical/snapd/blob/master/cmd/snap-confine/mount-support.c I ended up moving my stuff into my home directory which worked correctly. |
Beta Was this translation helpful? Give feedback.
-
|
I just lost almost 2 hours to this as well. I just wanted to do some quick tests with a certain docker-container in a quickly installed Ubuntu-VM. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
If you try to bind mount a path that's not on the list of paths snap allows external access to (e.g.
/media,/home), it will appear to work, but in fact will not, and will exhibit some fairly perverse behaviour. You will appear to have created the bind mount successfully, you will appear to have persistent storage, but in fact, the files are going - somewhere. Not sure where, asfinddoesn't turn them up. Presumably on the snap's temp filesystem?Repro steps:
Beta Was this translation helpful? Give feedback.
All reactions