Docker Community Forums

Share and learn in the Docker community.

Connecting NAS Drive to Container

I have created a series of docker containers through docker compose. The app within one of the containers downloads content, modifies the filename of the downloaded content, and moves the file to a NAS.

The NAS has been mounted to the Ubuntu server where the containers are running. At this time, the app/container is not able to see the mounted directory.

Before posting here, I searched for information that might help me solve this problem, but it didn’t appear to help or get me closer to solving the problem.

I attempted:

    docker run -it --mount src=`/media/NASVideos,target=/home/server1/docker/appname,type=bind appname

Very new to docker, but excited about the capabilities. Any help you could provide would be appreciated.

System Details:

  • OS of server = Ubuntu 16.04
  • Docker version = 18.09.2

The declaration in a docker-compose.yml looks like this:

volumes:
  - type: bind
    source: /media/NASVideos
    target: /home/server1/docker/appname
    read_only: false

You are aware that source is the path on the host and target is the path inside the container?

Make sure the remote share of the NASs mounted BEFORE you start the container, otherwise the container will only be able to see the content of the empty mount folder, but not the content of the remote share that was mounted into it later.

Your advice was helpful. I appreciate the post and information.