Search code examples
linuxdockernvidiadigits

Nvidia-docker add folder to container


I'm pretty new to docker containers. I understand there are ADD and COPY operations so a container can see files. How does one give the container access to a given directory where I can put my datasets?

Let's say I have a /home/username/dataset directory how do I make it at /dataset or something in the docker container so I can reference it?

Is there a way for the container to reference a directory on the main system so you don't have to have duplicate files. Some of these datasets will be quite large and while I can delete the original after copying it over .. that's just annoying if I want to do something outside the docker container with the files.


Solution

  • You cannot do that during the build time. If you want to do it during build time then you need to copy it into the context

    Or else when you run the container you need to do a volume bind mount

    docker run -it -v  /home/username/dataset:/dataset <image>