# How to mount persistent disk to HF Spaces In Docker?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-mount-persistent-disk-to-hf-spaces-in-docker%2F54161%3E%5C
**Category:** Spaces\
**Created:** [September 8, 2023, 8:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-mount-persistent-disk-to-hf-spaces-in-docker%2F54161 "2023-09-08T20:30:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamel](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hamel/32/1559_2.png) [@hamel](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fhamel)%5C
**Post date:** [September 8, 2023, 8:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-mount-persistent-disk-to-hf-spaces-in-docker%2F54161%2F1 "2023-09-08T20:30:19Z")

</div>

The new [persistent storage](https://huggingface.co/docs/hub/spaces-storage#persistent-storage-specs) seems fantastic. How do I mount the storage into the Docker container on spaces? An update to the documentation would be welcome here!

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [September 8, 2023, 9:21pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-mount-persistent-disk-to-hf-spaces-in-docker%2F54161%2F2 "2023-09-08T21:21:20Z")

</div>

hi @hamel, thanks for the feedback, we’ll improve the docs.

Unfortunately, at moment, `/data/` is not available at Docker build time, we’re looking into improve that DX cc @chris-rannou

Here is an example how I use it on a Dockerfile, by exporting the `huggingface-hub` env `HF_HOME` to point to the `/data/` , so in this example new downloaded models will be cached across rebuilds

```auto
ENV HF_HOME=/data/.huggingface 

```

> **[Dockerfile · SpacesExamples/Gradio-Docker-Persistent-Storage at main](https://huggingface.co/spaces/SpacesExamples/Gradio-Docker-Persistent-Storage/blob/main/Dockerfile#L23)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

Another useful workaround, since the data files are not on the UI yet, if you ever need, this is using nginx proxying the main web service in addition to a simple `autoindex` on the `/data/` folder. Please ignore the ComfyUI setup steps.

Dockerfile - [Dockerfile · radames/ComfyUI-data-index at main](https://huggingface.co/spaces/radames/ComfyUI-data-index/blob/main/Dockerfile)  
Nginx - [nginx.conf · radames/ComfyUI-data-index at main](https://huggingface.co/spaces/radames/ComfyUI-data-index/blob/main/nginx.conf)

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [December 19, 2023, 10:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-mount-persistent-disk-to-hf-spaces-in-docker%2F54161%2F3 "2023-12-19T22:06:55Z")

</div>

Split this topic on December 19, 2023, 10:06pm UTC

12 posts were split to a new topic: [Using Persistent Disk and External DB with Flowise Space](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fusing-persistent-disk-and-external-db-with-flowise-space%2F66391)
