Docker Mounting Error

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

# 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

# Set the default command to run your application when the container starts
CMD ["python3", ""]

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.

Do you mean you tried without GPU support and NFS worked or this is the first try and the problem is connecting to an NFS server?

“no route to host” indicates network error. What is your Docker version and how did you install Docker? Where is the NFS server? Is it a server on LAN network?

We usually need the following information to understand the issue:

  1. What platform are you using? Windows, Linux or macOS? Which version of the operating systems? In case of Linux, which distribution?

  2. How did you install Docker? Sharing the platform almost answers it, but only almost. Direct links to the followed guide can be useful.

  3. On debian based Linux, the following commands can give us some idea and recognize incorrectly installed Docker:

    docker info
    docker version

    Review the output before sharing and remove confidential data if any appears (public IP for example)

    dpkg -l | grep docker
    snap list docker