Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I need a password to get access to the jupyter notebook when I use docker machine?

Tags:

When I use docker machine to open my Jupyter notebook, there is a strange issue happening. The website needs me to enter password so that I can get access to the notebook. It is really strange! Do you know why? Actually, I am using my docker machine to use tensorflow to learn machine learning. I use docker container and terminal to get tensorflow and try to open jupyter notebook on the browser. But it lets me to enter password to use notebook after the Jupyter appeared on my browser.

like image 506
user144600 Avatar asked Dec 10 '16 19:12

user144600


People also ask

How do I run a jupyter notebook in Docker?

Run the following Docker run command in a command prompt to pull a Jupyter Docker Scipy-Notebook image and run its container. The Jupyter Docker Scipy-Notebook will run the Jupyter server and print the server URL in a console, click on that URL to open the JupyterLab application in the web browser.

Why is Jupyter asking for a password?

it still asks for a password for security reasons, since users with access can run arbitrary Python code on the server machine! so if your browser is not opening automatically, you can try one of those links, which seem to have a login token on them, and then investigate why your browser is not opening automatically.

How do I give access to my jupyter notebook?

You can set access control for Jupyter notebooks at the account level and at the object level. This feature is available in the latest version of Jupyter Notebooks. If you are not using the latest version of Jupyter notebooks, you can enable this feature from the Control Panel >> Account Features page.


1 Answers

You can supply the password to Tensor Flows docker container through an environment variable called PASSWORD like this:
docker run -it -p 8888:8888 -e "PASSWORD=abc123" gcr.io/tensorflow/tensorflow

Just add the -e parameter and specify you evironment variable after that.

If you look through the github repository for the docker image you can find this snippet at the bottom of jupyter_notebook_config.py

# sets a password if PASSWORD is set in the environment
if 'PASSWORD' in os.environ:
  c.NotebookApp.password = passwd(os.environ['PASSWORD'])
  del os.environ['PASSWORD']
like image 86
deRailed Avatar answered Oct 04 '22 22:10

deRailed