How do I start tensorflow docker jupyter notebook

后端 未结 10 2062
时光说笑
时光说笑 2020-12-07 09:15

I\'ve installed the tensorflow docker container on an ubuntu machine. The tensorflow docker setup instructions specify:

docker run -it b.gcr.io/tensorflow/t         


        
相关标签:
10条回答
  • 2020-12-07 09:49

    These steps worked for me if you are a total docker noob using a windows machine.

    Versions: Windows 8.1, docker 1.10.3, tensorflow r0.7

    1. Run Docker Quickstart Terminal
    2. After it is loaded, note the ip address. If you can't find it use this docker-machine ip and make a note. Lets call it 'ip address'. Will look something like this: 192.168.99.104 (I made up this ip address)
    3. Paste this command on the docker terminal:

      docker run -p 8888:8888 -p 6006:6006 b.gcr.io/tensorflow/tensorflow.

      If you are running this for the first time, it will download and install the image on this light weight vm. Then it should say 'The Jupyter notebook is running at ....' -> This is a good sign!

    4. Open your browser at: <your ip address (see above)>:8888. Eg. 192.168.99.104:8888/
    5. Hopefully you can see your ipython files.
    0 讨论(0)
  • 2020-12-07 09:51

    To get this to run under hyper-v. Perform the following steps:

    1) Create a docker virtual machine using https://blogs.msdn.microsoft.com/scicoria/2014/10/09/getting-docker-running-on-hyper-v-8-1-2012-r2/ this will get you a working docker container. You can connect to it via the console or via ssh. I'd put at least 8gb of memory since I'm sure this will use a lot of memory.

    2) run "ifconfig" to determine the IP address of the Docker VM

    3) On the docker shell prompt type:

    docker run -p 8888:8888 -p 6006:6006 -it b.gcr.io/tensorflow/tensorflow

    4) Connect to the Jupyter Workbench using http:/[ifconfig address]:8888/

    0 讨论(0)
  • 2020-12-07 09:54

    For some reason I ran into one additional problem that I needed to overcome beyond the examples provided, using the --ip flag:

    nvidia-docker run --rm \
      -p 8888:8888 -p 6006:6006 \
      -v `pwd`:/root \
      -it tensorflow/tensorflow:latest-devel-gpu-py3 sh -c "jupyter notebook --ip 0.0.0.0 ."
    

    And then I can access via http://localhost:8888 from my machine. In some ways this makes sense; within the container you bind to 0.0.0.0 which represents all available addresses. But whether I need to do this seems to vary (e.g I've started notebooks using jupyter/scipy-notebook without having to do this).

    In any case, the above command works for me, might be of use to others.

    0 讨论(0)
  • 2020-12-07 09:55

    After further reading of docker documentation I have a solution that works for me:

    docker run -p 8888:8888 -p 6006:6006 b.gcr.io/tensorflow/tensorflow ./run_jupyter.sh
    

    The -p 8888:8888 and -p 6006:6006 expose the container ports to the host on the same port number. If you just use -p 8888, a random port on the host will be assigned.

    The ./run_jupyter.sh tells docker what to execute within the container.

    With this command, I can use a browser on the host machine to connect to http://localhost:8888/ and access the jupyter notebook.

    UPDATE: After wrestling with docker on windows I switched back to a Ubuntu machine with docker. My notebook was being erased between docker sessions which makes sense after reading more docker documentation. Here is an updated command which also mounts a host directory within the container and starts jupyter pointing to that mounted directory. Now my notebook is saved on the host and will be available next time start up tensorflow.

    docker run -p 8888:8888 -p 6006:6006 -v /home/rob/notebook:/notebook b.gcr.io/tensorflow/tensorflow sh -c "jupyter notebook /notebook"
    
    0 讨论(0)
  • 2020-12-07 09:56

    It gives you the terminal prompt:

    FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd vdocker') DO %i
    docker run -it tensorflow/tensorflow:r0.9-devel
    

    or

    FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd vdocker') DO %i
    docker run -it b.gcr.io/tensorflow/tensorflow:latest-devel
    

    You should have 'vdocker' or change vdocker to 'default'.

    0 讨论(0)
  • 2020-12-07 09:58

    For a Linux host Robert Graves answer will work, but for Mac OS X or Windows there is more to be done because docker runs in a virtual machine.

    So to begin launch the docker shell (or any shell if you are using Linux) and run the following command to launch a new TensorFlow container:

    docker run -p 8888:8888 -p 6006:6006 b.gcr.io/tensorflow/tensorflow ./run_jupyter.sh
    

    Then for Mac OS X and Windows you need to do the following only once:

    1. Open VirtualBox
    2. Click on the docker vm (mine was automatically named "default")
    3. Open the settings by clicking settings
    4. In the network settings open the port forwarding dialog
    5. Click the + symbol to add another port and connect a port from your mac to the VM by filling in the dialog as shown below. In this example I chose port 8810 because I run other notebooks using port 8888.
    6. then open a browser and connect to http://localhost:8810 (or whichever port you set in the host port section
    7. Make your fancy pants machine learning app!
    0 讨论(0)
提交回复
热议问题