I’m struggling to get jupyerhub up and running.
Specially spawning jupyernotebooks.
I can login to jupyerhub but the spawner does not start jupyter_notebook right.
The url changes to oauth_callback?code= but I don’t use OAuth??
The jupyter_notebook container ist starting but brings the following error:
Both hub and notebook are in the same network:
"Containers": {
   "67858e937b69b28d096d507734d62f1ad26e628df2b2b0523ebce6a083ee47ab": {
        "Name": "jupyter-name",
        "IPv4Address": "192.168.96.3/20",
    },
    "b54c7cc972a21bb1966b8b01ca7cc199c6961ef3e9a0736424b437dcfb87840b": {
        "Name": "jupyterhub",
        "MacAddress": "02:42:c0:a8:60:02",
        "IPv4Address": "192.168.96.2/20",
    }
}
My setup:
docker-compose.yml:
version: "3"
services:
  jupyterhub:
    build:
      context: "/opt/jupyter/hub"
    image: mmw/jupyterhub:1.3
    container_name: jupyterhub
    env_file:
      - /opt/jupyter/.env
    networks:
      default:
      jupyter_net:
        aliases:
          - jupyterhub-net
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /var/jupyter/hub:/srv/jupyterhub
      - /opt/jupyter/hub/jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py
    restart: on-failure
  proxy:
    image: nginx:1.19.9
    container_name: jupyterhub-proxy
    ports:
      - 80:80
      - 443:443
    networks:
      default:
    volumes:
      - /opt/nginx/jupyterhub.conf:/etc/nginx/conf.d/jupyterhub.conf:z
      - /var/log/nginx:/var/log/nginx
      - /etc/ssl/certs/adsf.crt:/etc/nginx/conf.d/asdf.crt
      - /etc/ssl/private/asdf.pem:/etc/nginx/conf.d/asdf.pem
    restart: always
    links:
      - "jupyterhub"
  jupyterlab:
    build:
      context: "/opt/jupyter/notebook"
    image: asdf/jupyter_lab:test
    container_name: jupyterlab-throwaway
    network_mode: none
    command: echo
networks:
  default:
  jupyter_net:
    name: 'jupyter_net'
jupyerhub_config.py:
import os, sys
docker_machine_name = os.environ['DOCKER_MACHINE_NAME'] or 'jupyterhub'
c.JupyterHub.hub_ip = '0.0.0.0'
c.JupyterHub.hub_connect_ip = docker_machine_name
c.JupyterHub.port = 8000
c.JupyterHub.shutdown_on_logout = True
c.JupyterHub.cleanup_servers = False
c.JupyterHub.allow_named_servers = True
c.JupyterHub.named_server_limit_per_user = 2
c.JupyterHub.authenticator_class = 'ldapauthenticator.LDAPAuthenticator'
c.LDAPAuthenticator.server_address = 'ldaps://adsf.asdf.asdf'
c.LDAPAuthenticator.server_port = 636
c.LDAPAuthenticator.use_ssl = True
c.LDAPAuthenticator.bind_dn_template = 'CN={username},CN=Users,DC=asdf,DC=asdf'
c.LDAPAuthenticator.lookup_dn = True
c.LDAPAuthenticator.lookup_dn_search_filter = '({login_attr}={login})'
c.LDAPAuthenticator.lookup_dn_search_user = 'CN=adsf,CN=Users,DC=asdf,DC=asdf'
c.LDAPAuthenticator.lookup_dn_search_password = 'adsf'
c.LDAPAuthenticator.lookup_dn_user_dn_attribute = 'cn'
c.LDAPAuthenticator.user_search_base = 'cn=Users,DC=asdf,DC=asdf'
c.LDAPAuthenticator.user_attribute = 'sAMAccountName'
c.LDAPAuthenticator.allowed_groups = [
    'CN=adsf,OU=asdf,DC=asdf,DC=asdf',
]
c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
docker_notebook_image = os.environ['DOCKER_NOTEBOOK_IMAGE'] or 'jupyter/minimal-notebook:4d9c9bd9ced0'
c.DockerSpawner.image = docker_notebook_image
c.Spawner.cmd=["start-notebook.sh"]
network_name = os.environ['DOCKER_NETWORK_NAME'] or 'jupyter_net'
c.DockerSpawner.network_name = network_name
c.DockerSpawner.use_internal_ip = True
c.Spawner.disable_user_config = True
c.Spawner.cpu_limit = 1
c.Spawner.mem_limit = '10G'
nginx.conf:
upstream notebook {
    server jupyterhub:8000;
}
map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
}
server {
    listen                    80;
    listen                    [::]:80;
    server_name               asdf.asdf;
    return 302                https://$host$request_uri;
}
server {
    listen                    443 ssl;
    server_name               asdf.asdf;
    access_log                /var/log/nginx/nginx.access.log;
    error_log                 /var/log/nginx/nginx.error.log;
    ssl_certificate           /etc/nginx/conf.d/asdf.asdf.crt;
    ssl_certificate_key       /etc/nginx/conf.d/asdf.asdf.pem;
    ssl_protocols             TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;
    ssl_dhparam               /etc/nginx/conf.d/dhparam.pem;
    ssl_ciphers               'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
    ssl_session_timeout       1d;
    ssl_session_cache         shared:SSL:50m;
    ssl_stapling              on;
    ssl_stapling_verify       on;
    add_header                Strict-Transport-Security max-age=15768000;
    add_header                X-Frame-Options DENY;
    client_max_body_size      0;
    location / {
        proxy_pass            http://notebook;
        proxy_set_header      X-Real-IP $remote_addr;
        proxy_set_header      Host $http_host;
        proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_http_version    1.1;
        proxy_set_header      Upgrade $http_upgrade;
        proxy_set_header      Connection $connection_upgrade;
        proxy_set_header      X-Forwarded-Proto $scheme;
        proxy_read_timeout    86400;
        proxy_buffering       off;
    }
}
Found error from jupyter_notebook:
<h1>ERROR</h1>
    <h2>The requested URL could not be retrieved</h2>
    </div>
    <hr>
    <div id="content">
    <p>The following error was encountered while trying to retrieve the URL: <a href="http://jupyterhub:8081/hub/api/oauth2/token">http://jupyterhub:8081/hub/api/oauth2/token</a></p>
    <blockquote id="error">
    <p><b>Unable to determine IP address from host name <q>jupyterhub</q></b></p>
    </blockquote>
    <p>The DNS server returned:</p>
    <blockquote id="data">
    <pre>No DNS records</pre>
    </blockquote>
    <p>This means that the cache was not able to resolve the hostname presented in the URL. Check if the address is correct.</p>