I’m encountering an issue with mounting a Docker volume using NFS (Network File System). I’ve tried to create a volume with the following command:
$ docker volume create --driver local --opt type=nfs --opt o=addr={IP-Address},rw --opt device=:/john_data/Images nfs-volume
Then, when attempting to run a container with GPU support and mount the created volume, I received the following error:
docker run -it --rm --runtime=nvidia --gpus all -p 5000:5000 --mount source=nfs-volume,target=/john_data/Images event_analysis
docker: Error response from daemon: error while mounting volume '/var/lib/docker/volumes/nfs-volume/_data': failed to mount local volume: mount :/john_data/Images:/var/lib/docker/volumes/nfs-volume/_data, data: addr={IP-Address}: no route to host.
Here’s the Dockerfile I’m using:
# Use the NVIDIA CUDA base image with cuDNN and Ubuntu 20.04
FROM nvidia/cuda:11.6.2-cudnn8-devel-ubuntu20.04
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
curl \
apt-utils \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory inside the container
WORKDIR /app
# Copy the content of the current directory to the working directory
COPY . /app
# Install Python packages from requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Expose port 5000 to the outside world
EXPOSE 5000
# Set the default command to run your application when the container starts
CMD ["python3", "main.py"]
I’m uncertain why the mount is failing with the error message indicating “no route to host.” Any insights or suggestions on how to troubleshoot and resolve this issue would be greatly appreciated! Thank you in advance for any help provided.