diff --git a/docs/hub/spaces-sdks-docker-examples.md b/docs/hub/spaces-sdks-docker-examples.md index d09fb1b67..1194c8720 100644 --- a/docs/hub/spaces-sdks-docker-examples.md +++ b/docs/hub/spaces-sdks-docker-examples.md @@ -1,6 +1,6 @@ # Docker Spaces Examples -We gathered some example demos in the [Docker Templates](https://huggingface.co/DockerTemplates) organization. Please check them out! +We gathered some example demos in the [Spaces Examples](https://huggingface.co/SpacesExamples) organization. Please check them out! * Dummy FastAPI app: https://huggingface.co/spaces/DockerTemplates/fastapi_dummy * FastAPI app serving a static site and using `transformers`: https://huggingface.co/spaces/DockerTemplates/fastapi_t5 diff --git a/docs/hub/spaces-sdks-docker.md b/docs/hub/spaces-sdks-docker.md index f99c8a5ac..6facf66d2 100644 --- a/docs/hub/spaces-sdks-docker.md +++ b/docs/hub/spaces-sdks-docker.md @@ -133,11 +133,28 @@ COPY --chown=user checkpoint . The data written on disk is lost whenever your Docker Space restarts, unless you opt-in for a [persistent storage](./spaces-storage) upgrade. +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. + + +At the moment, `/data` volume is only available at runtime, i.e. you cannot use `/data` during the build step of your Dockerfile. + + 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. 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. +### Docker container with GPU + +You can run Docker containers with GPU support by using one of our GPU-flavored [Spaces Hardware](./spaces-gpus). + +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. + + +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). + + ## Read More - [Full Docker demo example](spaces-sdks-docker-first-demo) - [List of Docker Spaces examples](spaces-sdks-docker-examples) +- [Spaces Examples](https://huggingface.co/SpacesExamples)