Dynamic share mount into docker
Last updated
Last updated
Utilizing bind mounts in the stack/compose configuration allows the mounting of the root '/mnt' mount point into the Docker environment. Consequently, when a new share is added on the host side, it becomes available within the Docker system.
Notably, the file or directory does not need to exist on the Docker host beforehand; it is created on demand if absent. While bind mounts are highly performant, it is important to note that they depend on the host machine's filesystem having a specific directory structure available.
Exercise caution when using this function. The automatic/dynamic mounting of all sub-folders can pose a security risk.
We recommend discussing this internally with your IT department before proceeding.
The required modifications for this are straightforward and easily implemented:
Consider that the default basic /mnt:/Volumes mounting needs to be removed or changed to a comment, as this would lead to an issue when deploying the stack.
For further information and assistance, here are the Docker references https://docs.docker.com/storage/bind-mounts https://docs.docker.com/storage/bind-mounts/#configure-bind-propagation