0

I followed the graph-tool docker installation instructions here. I've set up Docker Toolbox (can't use Docker for Windows, not on Pro), and I've gotten jupyter running with the Docker image.

However, I need to access a notebook in my C: drive. For the sake of this post let's say the notebook is in C:\Users\Gab\Desktop. I've successfully moved into that location, but when I run the command docker run -p 8888:8888 -p 6006:6006 -it -u user -w /home/user tiagopeixoto/graph-tool bash, it opens a bash in /home/user, not in the directory I cd'd into previously.

From what I understand, the -w /home/user is what tells it where to open, but I'm not sure how to tell it to open in the Desktop folder.

How can I set things up properly so that I can run the command jupyter notebook --ip 0.0.0.0, and still be able to access the notebook I need?

Thanks!

Gab De Jesus
  • 187
  • 1
  • 14

1 Answers1

0

Here's the deal with Docker. When you execute the docker run command, what happens is that an entirely new subsystem is created which is separate from your host Operating System ( this is known as a Docker container ). This subsystem runs the tiagopeixoto/graph-tool image in it so hence the graph-tool ( and hence jupyter-notebook ) and the entrypoint /home/user is present inside this system instead of the host OS you use to run the Docker container ( in your case its Windows ). Unfortunately for you the notebook that you wish to view using jupyter-notebook isn't present inside the container and is located elsewhere ( Windows to be exact ).

What you can do in this case is mount a folder of the host Operating System to the container such that this folder contains the notebook you wish to view :-

  • Open a new command prompt, and type in this command as follows :- docker run -p 8888:8888 -p 6006:6006 -v /c/Users/Gab/Desktop:/mnt/temp/ -it -u user -w /home/user tiagopeixoto/graph-tool bash

The main difference to note here is the -v switch which mounts the C:\Users\Gab\Desktop volume from the host system to the Docker container in /mnt/temp/. Once that is done try viewing the notebook present in /mnt/temp in jupyter-notebook.

According to this post there exists an issue related to mounting a volume in Windows, so please check this out as well :- docker toolbox mount file on windows

  • Assuming the command works, should I be able to see the mounted directory's contents with `ls -la` or something? I tried the command with /c/ and //c/, but neither shows anything. Also where can I find /mnt/temp? – Gab De Jesus Jun 19 '18 at 14:48
  • Yes absolutely. If the command works, it should be visible if you do `ls /mnt/temp` inside the container. Use the `docker ps` command in windows to check all the running containers and stop unwanted ones and remove them using the `docker stop` and `docker rm` commands respectively. To execute the prompt of the container through the windows level prompt do `docker exec -it bash`. – Siddharth Srinivasan Jun 19 '18 at 15:16
  • Another thing, the docker engine generally gives random names to docker containers which you run using the `docker run` command. I suggest you delete all the other instances you've created and add another switch `-name` in the `docker run` statement. So the command effectively becomes `docker run -name graph-container -p 8888:8888 -p 6006:6006 -v /c/Users/Gab/Desktop:/mnt/temp/ -it -u user -w /home/user tiagopeixoto/graph-tool bash` for an instance named *graph-container*. – Siddharth Srinivasan Jun 19 '18 at 15:19
  • Since you're running graph-tool and jupyter using Docker it's better to know a little bit more about how Docker works. – Siddharth Srinivasan Jun 19 '18 at 15:21