Skip to content

Commit f6fc645

Browse files
authored
few edits to the docker docs (#1006)
1 parent 13ee726 commit f6fc645

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

docs/hub/spaces-sdks-docker-examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Docker Spaces Examples
22

3-
We gathered some example demos in the [Docker Templates](https://huggingface.co/DockerTemplates) organization. Please check them out!
3+
We gathered some example demos in the [Spaces Examples](https://huggingface.co/SpacesExamples) organization. Please check them out!
44

55
* Dummy FastAPI app: https://huggingface.co/spaces/DockerTemplates/fastapi_dummy
66
* FastAPI app serving a static site and using `transformers`: https://huggingface.co/spaces/DockerTemplates/fastapi_t5

docs/hub/spaces-sdks-docker.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,28 @@ COPY --chown=user checkpoint .
133133

134134
The data written on disk is lost whenever your Docker Space restarts, unless you opt-in for a [persistent storage](./spaces-storage) upgrade.
135135

136+
If you opt-in for a persistent storage upgrade, you can use the `/data` directory to store data. This directory is mounted on a persistent volume, which means that the data written in this directory will be persisted across restarts.
137+
138+
<Tip warning="{true}">
139+
At the moment, `/data` volume is only available at runtime, i.e. you cannot use `/data` during the build step of your Dockerfile.
140+
</Tip>
141+
136142
You can also use our Datasets Hub for specific cases, where you can store state and data in a git LFS repository. You can find an example of persistence [here](https://huggingface.co/spaces/julien-c/persistent-data), which uses the [`huggingface_hub` library](https://huggingface.co/docs/huggingface_hub/index) for programmatically uploading files to a dataset repository.
137143

138144
Finally, in some cases, you might want to use an external storage solution from your Space's code like an external hosted DB, S3, etc.
139145

146+
### Docker container with GPU
147+
148+
You can run Docker containers with GPU support by using one of our GPU-flavored [Spaces Hardware](./spaces-gpus).
149+
150+
We recommend using the [`nvidia/cuda`](https://hub.docker.com/r/nvidia/cuda) from Docker Hub as a base image, which comes with CUDA and cuDNN pre-installed.
151+
152+
<Tip warning="{true}">
153+
During Docker buildtime, you don't have access to a GPU hardware. Therefore, you should not try to run any GPU-related command during the build step of your Dockerfile. For example, you can't run `nvidia-smi` or `torch.cuda.is_available()` building an image. Read more [here](https://github.com/NVIDIA/nvidia-docker/wiki/nvidia-docker#description).
154+
</Tip>
155+
140156
## Read More
141157

142158
- [Full Docker demo example](spaces-sdks-docker-first-demo)
143159
- [List of Docker Spaces examples](spaces-sdks-docker-examples)
160+
- [Spaces Examples](https://huggingface.co/SpacesExamples)

0 commit comments

Comments
 (0)