Authenticating Jupyter notebook on docker
You can also disable the token or add a customised token with the --NotebookApp.token=''
parameter of the start-notebook.sh
script. Coping the token from the Terminal often causes errors and is uncomfortable.
Disable token
Easily as follows:
docker run -d -p 8888:8888 jupyter/pyspark-notebook start-notebook.sh --NotebookApp.token=''
Customised Token
However, this is not recommended and you have the option to define an easy password:
docker run -d -p 8888:8888 jupyter/pyspark-notebook start-notebook.sh --NotebookApp.token='MY_EASY_PASSWORD'
The stdout
of the container will give you a special URL that has a token for you to login with. You can either run in the foreground (without -d
) or just checking the current container logs with docker logs <container_id>
. There, you should see output like the following:
[I 16:57:05.859 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 16:57:05.871 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 16:57:05.877 NotebookApp] Serving notebooks from local directory: /notebooks
[I 16:57:05.877 NotebookApp] 0 active kernels
[I 16:57:05.877 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=42685cc246e6571c0f16417327fbf4c398061125c00edea5
[I 16:57:05.877 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 16:57:05.878 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=42685cc246e6571c0f16417327fbf4c398061125c00edea5