# Dynamic share mount into docker

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.

{% hint style="warning" %}
Exercise caution when using this function.\
The automatic/dynamic mounting of all sub-folders can pose a security risk.&#x20;

**We recommend discussing this internally with your IT department before proceeding.**
{% endhint %}

The required modifications for this are straightforward and easily implemented:

<figure><img src="/files/pDaYBnxLpIeEX5wDncl4" alt=""><figcaption><p>Volume mounting via bind</p></figcaption></figure>

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.

<details>

<summary>Configuration example docker bind</summary>

```json
volumes:
      - type: bind
        bind:
          propagation: rslave
        source: /mnt
        target: /Volumes
      
      # Old static method to mount a share/folder
      #- /mnt:/Volumes
      
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro     
      
```

</details>

<figure><img src="/files/Z9b8OSukj2s2GRjmcD1S" alt=""><figcaption><p>Demonstration of dynamic share mount in docker</p></figcaption></figure>

{% hint style="info" %}
**For further information and assistance, here are the Docker references**\
\
[https://docs.docker.com/storage/bind-mounts](https://docs.docker.com/storage/bind-mounts/)\
<https://docs.docker.com/storage/bind-mounts/#configure-bind-propagation>
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.helmut.de/helmut4-releases/v4.7.2/getting-started/additional-configurations/dynamic-share-mount-into-docker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
