JupyterHub with GitHub authenticator and local spawner (original) (raw)

I am trying to run JupyterHub in Docker for just myself, using GitHub authentication.
The login process with GitHub works perfectly fine for my pcgeek86 account.
I also tested another GitHub account, and was denied access, as expected (good thing).

After logging into JupyterHub, I click the button to start a Jupyter server. In the Docker logs, the Jupyter Server starts up successfully.

Problem: Then when I try to go to that port for the new Jupyter Server, I get an HTTP 404 Not Found. The web server is responding, so the Docker port mapping is correct, but I can’t access the Jupyter Notebook UI.

What’s the correct URL path to access the Jupyter web UI (JupyterLab?)?

image

You are requesting a page that does not exist!

JupyterHub Configuration

config.py

c = get_config()  #noqa

c.JupyterHub.authenticator_class = "github"
c.OAuthenticator.oauth_callback_url = "http://localhost:8888/hub/oauth_callback"
c.OAuthenticator.client_id = "xxxxxxxxxxxxxxxxx"
c.OAuthenticator.client_secret = "xxxxxxxxxxxxxxxx"
c.GitHubOAuthenticator.allowed_users = {'pcgeek86'}
c.GitHubOAuthenticator.username_map = {
  'pcgeek86': 'root'
}

c.Spawner.args = [
  '--allow-root'
]
c.Spawner.port = 3880
c.Spawner.ip = '0.0.0.0'

Dockerfile

Dockerfile

FROM jupyterhub/jupyterhub

RUN pip3 install oauthenticator && pip3 install jupyter_server

ADD ["config.py", "/srv/jupyterhub/jupyterhub_config.py"]

CMD ["jupyterhub", "-f", "/srv/jupyterhub/jupyterhub_config.py"]

Docker Build / Run Commands

With the two files above, I just run these commands to build the container image and start the Jupyter Hub container.

docker build --tag jupyterhub-trevor-github-oauth $PSScriptRoot

docker run --rm -it --publish 8888:8000 --publish 8889:3880 jupyterhub-trevor-github-oauth

minrk April 26, 2025, 5:36am 2

It looks like you haven’t installed jupyterlab. Add jupyterlab to the packages you install, then you should see it when you launch the server (the url will be /users/username/lab)

Also, in jupyterhub, you don’t connect directly to any ports other than the proxy (default is 8000), so there shouldn’t be a need to set or know the spawner port.