Can't run jupyter using docker compose with nginx

56 views Asked by At

i am trying to run python script on jupyter using docker compose but can't connect to python kernel and this is my docker compose file which running on ubuntu vm :

version: "3"

services:
   jupyter:
      container_name: jupyter
      image: jupyter/scipy-notebook
      ports:
         - 8888:8888
      volumes:
         - ./jupyter:/home/jovyan/work
      environment:
         - JUPYTER_TOKEN=password
      command: jupyter notebook --ServerApp.iopub_data_rate_limit=10000000 && ["jupyter", "lab", "--debug"]
      networks:
         testing_net:
            ipv4_address: 172.18.0.3

networks:
    testing_net:
        ipam:
            driver: default
            config:
                - subnet: 172.18.0.2/16

and this is my nginx configuration

location / {
                proxy_set_header   X-Forwarded-For $remote_addr;
                proxy_set_header   Host $http_host;
                proxy_pass         http://localhost:8888;
                proxy_redirect off;
        }

when i'm trying to run any python code on jupyter can't connect to kernel an it gives me this error in the docker logs

[W 2023-10-22 06:55:09.321 ServerApp] Replacing stale connection: ab4cb6a6-12c1-4d60-9730-ec05070a5f5f:56fc3464-cb08-4d4c-8d8b-7962be661691
[W 2023-10-22 06:55:09.322 ServerApp] 400 GET /api/kernels/ab4cb6a6-12c1-4d60-9730-ec05070a5f5f/channels?session_id=56fc3464-cb08-4d4c-8d8b-7962be661691 ([email protected]) 1.78ms referer=None
0

There are 0 answers