1

Hi I am trying to get TensorFlow notebook folder mounted to /src/work folder in Ubuntu.

sudo docker run -it -v /src/work:/HOME/notebooks -p 8888:8888 tensorflow/tensorflow:1.3.0

I have tried many combination of -v flags. It is not reading the files already in my work folder or saving new files to it.

Vivek Shankar
  • 770
  • 1
  • 15
  • 37
kristoph
  • 101
  • 2
  • 13
  • "TensorFlow notebook folder mounted to `/src/work`". This suggests you're trying to mount the notebook to the container. Is that correct? – Vivek Shankar Aug 22 '17 at 07:02
  • @Shanky according to the offical dockerfile https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/docker/Dockerfile WORKDIR "/notebooks" – kristoph Aug 22 '17 at 07:10
  • 1
    The dockerfile helped. Please see my edited answer. Also consider editing your question to avoid confusion for future visitors. – Vivek Shankar Aug 22 '17 at 07:22

2 Answers2

3

You're mounting the volume incorrectly, precisely the path. It should be

-v ~/[absolute path from $HOME]/src/work:~/notebooks/

Explanation:

Since your working directory is /notebooks, which places it at /$HOME/notebooks. You use ~ to get to the $HOME.

Vivek Shankar
  • 770
  • 1
  • 15
  • 37
  • That worked. docker run -it -v /home/linuxnikola/work:/notebooks -p 8888:8888 tensorflow/tensorflow:1.3.0 Sorry I was confused with /HOME/notebooks Now the files are persistent but I am not loading the demo files from the container. But that is not a big deal. cheers. – kristoph Aug 22 '17 at 07:33
  • Happy to help :) – Vivek Shankar Aug 22 '17 at 07:35
  • 3
    the latest tensorflow containers now serve from /tf so instead of `:/notebooks` place `:/tf` – Tendai Feb 25 '19 at 20:13
1

This will work as expected. Make sure you have a src folder in the host's root directory (/) eg. you may have ~/repo/src/work this is different than /src/work. In the container, the files will show up exactly on root's /HOME/notebooks directory.

Make sure you are checking the files in the right directory.

Sumsuddin Shojib
  • 3,583
  • 3
  • 26
  • 45