How to use Google Colab with a local TensorFlow Jupyter server using Powershell on Windows 10?

Viewed 1008

I'm trying to learn TensorFlow on Windows 10 using Docker, but I'm stuck at the very beginning of the environment setup.

I followed this: https://www.tensorflow.org/install#download-a-package

And did:

docker run -it -p 8888:8888 tensorflow/tensorflow:latest-py3-jupyter

Then I followed this: https://www.tensorflow.org/tutorials/quickstart/beginner

Problem is when I tried to connect to my local server with Google Colab (using Google Chrome), I get the following error in the docker log:

Blocking Cross Origin API request for /http_over_websocket. Origin: https://colab.research.google.com, Host: localhost:8888

The error is very explicit and Google Colab gave me the solution right away:

jupyter notebook \
--NotebookApp.allow_origin='https://colab.research.google.com' \ --port=8888 \ --NotebookApp.port_retries=0

But, for the life of me, I cannot figure out how to add this parameter to the docker image/container/command/configuration...

What I tried so far:

  1. I tried passing the parameters to the docker run command but it doesn't work.
  2. I tried running the container without -it and then connect to it to relaunch the server with these parameters but as soon as I stop the Jupyter server, it stops the docker.
  3. I tried to specify "-u $(id -u):$(id -g)" when starting the docker, since I get a warning at the container start that I shouldn't connect as the root user... But it's not working, since I'm using PowerShell on Windows 10.

Any help would be appreciated :)

1 Answers

Alright, after a few hours of searching around I found out how to overwrite a docker image default CMD to append the "--NotebookApp.allow_origin='https://colab.research.google.com'" and it worked!

So the solution is:

docker run -it -p 8888:8888 tensorflow/tensorflow:latest-py3-jupyter jupyter notebook --notebook-dir=/tf --ip 0.0.0.0 --no-browser --allow-root --NotebookApp.allow_origin='https://colab.research.google.com'
Related