Mount Data Volumes#
This guide explains how to mount data volumes (host directories or NFS shares) into Dioptra worker containers for accessing datasets and other artifacts.
Prerequisites#
Prepare Your Deployment - A configured Dioptra deployment
Use Docker Compose Override Files - Override file created
(For NFS) Network access to the NFS server
Overview#
The docker-compose.yml file generated by the cookiecutter template supports mounting a single datasets directory from the host machine into worker containers via the datasets_directory variable.
For more advanced configurations, use the docker-compose.override.yml file.
Common reasons for mounting additional folders:
Your datasets are stored in a folder on your host machine or in an NFS share
You want to make other artifacts available to the worker containers, such as pre-trained models
Option A: Mount a Host Directory#
Step A1: Verify Directory Permissions#
Ensure the folder and all of its files are world-readable:
find <host-data-path> -type d -print0 | xargs -0 chmod o=rx
find <host-data-path> -type f -print0 | xargs -0 chmod o=r
Note
Replace <host-data-path> with the absolute path to your data directory on the host machine (e.g., /home/data, /mnt/datasets).
Step A2: Add Volume Mount to Workers#
Open docker-compose.override.yml in a text editor and add a block for each worker container that needs access to the data.
Worker container names include tfcpu, tfgpu, pytorchcpu, or pytorchgpu.
This example mounts the host data directory to /dioptra/data in the container as read-only:
services:
<deployment-name>-tfcpu-01:
volumes:
- "<host-data-path>:/dioptra/data:ro"
Note
Replace <deployment-name> with your deployment’s slugified name (default: dioptra-deployment) and <host-data-path> with the absolute path to your data directory.
Repeat for each worker container that needs access to the data.
See Also#
Use Docker Compose Override Files - Docker Compose override file basics
how-to-download-data - Download example datasets
Prepare Your Deployment - Full deployment customization
Integrate Custom Containers - Add custom containers to your deployment