qtangs / sagemaker-notebook-container

Docker images that replicate the Amazon SageMaker Notebook instance.
MIT License
58 stars 30 forks source link

Token Authentication is enabled, but unable to login #2

Closed ruijzndl closed 5 years ago

ruijzndl commented 5 years ago

I pulled the sagemaker notebook container from Docker Hub using tag tensorflow-p36 and followed the instructions as specified in the README.md. Yet it has been problematic using this jupyter notebook as authentication does not appear to work.

I am presented with the login screen when I open the URL that the start script outputs, and manually pasting the token into the authentication field also results in an 'invalid credentials' message. Disabling token / password authentication doesn't resolve this issue either, as the notebook server still presents me with a login screen.

The command I'm using to run this notebook is the following:

docker run -p 8888:8888 -v $(pwd):/home/ec2-user/SageMaker qtangs/sagemaker-notebook:tensorflow-p36

As I don't need the AWS SDK and CLI for now, I have not included any credentials for these tools in the docker run command.

qtangs commented 5 years ago

I tested the same command, it works fine outputting the following URL, note that the token consists of only alphanumeric characters:

[I 08:20:48.332 NotebookApp] The Jupyter Notebook is running at:
[I 08:20:48.333 NotebookApp] http://5f01fc2efe73:8888/?token=b8036342f6f327b3b396553b42bd86819916d312c05c4072
[I 08:20:48.333 NotebookApp]  or http://127.0.0.1:8888/?token=b8036342f6f327b3b396553b42bd86819916d312c05c4072

If you still can't get this to work, try building a new image with a preset password like this (password is pass123):

#Dockerfile.test
FROM qtangs/sagemaker-notebook:tensorflow-p36

RUN sed -ie "/^#c.NotebookApp.password/c\c.NotebookApp.password = 'sha1:fe3e0bde3016:dd7cbb05c6ed2673448512e3993d1c0f62909ead'" ~/.jupyter/jupyter_notebook_config.py
docker build -t test -f Dockerfile.test .
docker run -p 8888:8888 -v $(pwd):/home/ec2-user/SageMaker test
# once done open this in browser: http://127.0.0.1:8888/

Note: To get the hashed password for any other password, you can run this, replacing pass123 with a password of your choice:

docker run --rm qtangs/sagemaker-notebook:tensorflow-p36 python -c "from notebook.auth import passwd; print(passwd('pass123'))"
qtangs commented 5 years ago

@ruijzndl, I’m closing this issue assuming you’ve got it working. Feel free to let me know if there’s still any issue.