Jupyter Notebook authentication inside Docker leads to invalid token
I am trying to start a Jupyter notebook from a docker container. I'm runing
jupyter notebook --allow-root --no-browser --ip=0.0.0.0
which produces
[I 20:04:41.067 NotebookApp] Serving notebooks from local directory: /local/directory/path/
[I 20:04:41.067 NotebookApp] 0 active kernels
[I 20:04:41.067 NotebookApp] The Jupyter Notebook is running at: http://0.0.0.0:8888/?token=8950efa69b640e2b330dd86007b295f96d33d93cdd584830
[I 20:04:41.068 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 20:04:41.179 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://0.0.0.0:8888/?token=8950efa69b640e2b330dd86007b295f96d33d93cdd584830`
When I go to register in the browser, however, the link prompts me to enter a token, and the one above ( 895...
) returns an "invalid token".
I am running Jupyter 4.3.0.
How do I open my laptop?
Yes, there is a similar question, but the marker obtained above works in their case.
source to share
You probably didn't forward the port from container to host when starting the container:
docker run -it -p 8888:8888 tag --port=8888
But that should give you ERR_CONNECTION_REFUSED
if you don't already have a locally running jupyter on 8888, which of course doesn't recognize the token from the docker instance. Try running a container with port forwarding and make sure it is different from any local instance.
source to share