Skip to content
Advertisement

how to mount a local volume for my docker?

i am newbie to the Linux and docker. I am using the below command to run the docker:

sudo nvidia-docker run --gpus all -p 8888:8888 -it -v /home/pyman/PEYMAN:??????? 21bbc6c8f7ed

where; /home/pyman/PEYMAN is my local directory

and 21bbc6c8f7ed is the image ID.

after running this command, the workspace root changes to root@0ce2ee24bac0:/workspace#

then I type jupyter notebook and run it, and it provides two links which only the second link opens the jupyter notebook in the browser.

http://hostname:8888/?token=xxxxxxxxxxx
http://127.0.0.1:8888/?token=xxxxxxxxxxx

but I dont know what is my container_dir in the first command to put in ?????, and how to get the directory. is the container_dir the same directory that jupyter is?

Advertisement

Answer

The container_dir is the path inside the container, where you’d like to see your mounted files. The directory inside container does not even have to exist, yon can pick almost any place to mount your files. If you work with jupyter, it makes sense to add your files to the working directory:

docker run -v /home/pyman/PEYMAN:/workspace/myfiles

Once inside the container you will find /home/pyman/PEYMAN in /workspace/myfiles.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement