ipjupyterjupyterhub

--ip=0.0.0.0 option is not applied to jupyter lab command in docker


In /etc/jupyter/jupyter_server_config.py I have the setting c.ServerApp.ip = "0.0.0.0" and even I use --ip=0.0.0.0 in the command as jupyter lab --ip="0.0.0.0" --debug --config=dir=/etc/jupyter

But the server runs always on 127.0.0.1, not 0.0.0.0:

jovyan@ac08ae367d58:~$ jupyter lab --ip="0.0.0.0" --debug --config=dir=/etc/jupyter                                                                                                                                                                                            
[D 2022-09-22 23:25:57.952 ServerApp] Searching ['/home/jovyan', '/home/jovyan/.jupyter', '/home/jovyan/.local/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files                                                                                        
[D 2022-09-22 23:25:57.952 ServerApp] Looking for jupyter_config in /etc/jupyter                                                                                                                                                                                               
[D 2022-09-22 23:25:57.952 ServerApp] Looking for jupyter_config in /usr/local/etc/jupyter                                                                                                                                                                                     
[D 2022-09-22 23:25:57.952 ServerApp] Looking for jupyter_config in /home/jovyan/.local/etc/jupyter                                                                                                                                                                            
[D 2022-09-22 23:25:57.953 ServerApp] Looking for jupyter_config in /home/jovyan/.jupyter                                                                                                                                                                                      
[D 2022-09-22 23:25:57.953 ServerApp] Looking for jupyter_config in /home/jovyan                                                                                                                                                                                               
[D 2022-09-22 23:25:57.955 ServerApp] Looking for jupyter in dir=/etc                                                                                                                                                                                                          
[D 2022-09-22 23:25:57.958 ServerApp] Paths used for configuration of jupyter_server_config:                                                                                                                                                                                   
        /etc/jupyter/jupyter_server_config.json                                                                                                                                                                                                                                
[D 2022-09-22 23:25:57.958 ServerApp] Paths used for configuration of jupyter_server_config:                                                                                                                                                                                   
        /usr/local/etc/jupyter/jupyter_server_config.d/jupyterlab.json                                                                                                                                                                                                         
        /usr/local/etc/jupyter/jupyter_server_config.d/nbclassic.json                                                                                                                                                                                                          
        /usr/local/etc/jupyter/jupyter_server_config.d/notebook_shim.json
        /usr/local/etc/jupyter/jupyter_server_config.json
[D 2022-09-22 23:25:57.959 ServerApp] Paths used for configuration of jupyter_server_config: 
        /home/jovyan/.local/etc/jupyter/jupyter_server_config.json
[D 2022-09-22 23:25:57.960 ServerApp] Paths used for configuration of jupyter_server_config: 
        /home/jovyan/.jupyter/jupyter_server_config.json
[D 2022-09-22 23:25:57.960 ServerApp] Paths used for configuration of jupyter_server_config: 
        /home/jovyan/jupyter_server_config.json
[D 2022-09-22 23:25:57.977 LabApp] Config changed: {'NotebookApp': {}, 'ServerApp': {'ip': '0.0.0.0', 'config_file': 'dir=/etc/jupyter', 'log_level': 'DEBUG', 'jpserver_extensions': <LazyConfigValue {'update': {'nbclassic': True, 'notebook_shim': True}}>}, 'ExtensionApp'
: {'log_level': 'DEBUG'}}
[I 2022-09-22 23:25:57.978 ServerApp] jupyterlab | extension was successfully linked.
[D 2022-09-22 23:25:57.990 NotebookApp] Config changed: {'NotebookApp': {}, 'ServerApp': {'ip': '0.0.0.0', 'config_file': 'dir=/etc/jupyter', 'log_level': 'DEBUG', 'jpserver_extensions': <LazyConfigValue value={'jupyterlab': True, 'nbclassic': True, 'notebook_shim': True
}>}, 'ExtensionApp': {'log_level': 'DEBUG'}}
[I 2022-09-22 23:25:57.991 ServerApp] nbclassic | extension was successfully linked.
[D 2022-09-22 23:25:58.260 ServerApp] Paths used for configuration of jupyter_notebook_config: 
        /home/jovyan/.jupyter/jupyter_notebook_config.json
[D 2022-09-22 23:25:58.261 ServerApp] Paths used for configuration of jupyter_notebook_config: 
        /etc/jupyter/jupyter_notebook_config.json
[D 2022-09-22 23:25:58.261 ServerApp] Paths used for configuration of jupyter_notebook_config: 
        /usr/local/etc/jupyter/jupyter_notebook_config.d/jupyterlab.json
        /usr/local/etc/jupyter/jupyter_notebook_config.json
[D 2022-09-22 23:25:58.262 ServerApp] Paths used for configuration of jupyter_notebook_config: 
        /home/jovyan/.local/etc/jupyter/jupyter_notebook_config.json
[D 2022-09-22 23:25:58.263 ServerApp] Paths used for configuration of jupyter_notebook_config: 
        /home/jovyan/.jupyter/jupyter_notebook_config.json
[I 2022-09-22 23:25:58.263 ServerApp] notebook_shim | extension was successfully linked.
[D 2022-09-22 23:25:58.265 ServerApp] Config changed: {'ExtensionApp': {'log_level': 'DEBUG'}, 'NotebookApp': {}, 'ServerApp': {'ip': '0.0.0.0', 'config_file': 'dir=/etc/jupyter', 'log_level': 'DEBUG', 'jpserver_extensions': <LazyConfigValue value={'jupyterlab': True, 'nbclassic': True, 'notebook_shim': True}>}}
[I 2022-09-22 23:25:58.282 ServerApp] notebook_shim | extension was successfully loaded.
[I 2022-09-22 23:25:58.283 LabApp] JupyterLab extension loaded from /usr/local/lib/python3.10/site-packages/jupyterlab
[I 2022-09-22 23:25:58.283 LabApp] JupyterLab application directory is /usr/local/share/jupyter/lab
[I 2022-09-22 23:25:58.286 ServerApp] jupyterlab | extension was successfully loaded.
[I 2022-09-22 23:25:58.289 ServerApp] nbclassic | extension was successfully loaded.
[I 2022-09-22 23:25:58.290 ServerApp] Serving notebooks from local directory: /home/jovyan
[I 2022-09-22 23:25:58.290 ServerApp] Jupyter Server 1.18.1 is running at:
[I 2022-09-22 23:25:58.290 ServerApp] http://ac08ae367d58:8888/lab?token=e2e2ac0e0ccf1f2c0a72b5d625e2f1ba3ada18d3bc177df5
[I 2022-09-22 23:25:58.290 ServerApp]  or http://127.0.0.1:8888/lab?token=e2e2ac0e0ccf1f2c0a72b5d625e2f1ba3ada18d3bc177df5
[I 2022-09-22 23:25:58.290 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 2022-09-22 23:25:58.295 ServerApp] No web browser found: could not locate runnable browser.
[C 2022-09-22 23:25:58.295 ServerApp] 
    
    To access the server, open this file in a browser:
        file:///home/jovyan/.local/share/jupyter/runtime/jpserver-252-open.html
    Or copy and paste one of these URLs:
        http://ac08ae367d58:8888/lab?token=e2e2ac0e0ccf1f2c0a72b5d625e2f1ba3ada18d3bc177df5
     or http://127.0.0.1:8888/lab?token=e2e2ac0e0ccf1f2c0a72b5d625e2f1ba3ada18d3bc177df5
[D 2022-09-22 23:26:03.300 ServerApp] 200 GET /api (127.0.0.1) 0.84ms
^C[I 2022-09-22 23:26:07.953 ServerApp] interrupted
Serving notebooks from local directory: /home/jovyan
0 active kernels
Jupyter Server 1.18.1 is running at:
http://ac08ae367d58:8888/lab?token=e2e2ac0e0ccf1f2c0a72b5d625e2f1ba3ada18d3bc177df5
 or http://127.0.0.1:8888/lab?token=e2e2ac0e0ccf1f2c0a72b5d625e2f1ba3ada18d3bc177df5

How can I run the jupyter lab with ip 0.0.0.0? This is docker image to be used in JupyterHub, and in the hub the phenomenon is not change.

The problem is, proxy is not working on the 127.0.0.1. Any comment will be helpful for me. Thank you so much!


Solution

  • This is not a jupyterlab issue. You cannot host at 0.0.0.0. This is used as shorthand for “any address” and jupyterlab interprets this as “no preference” and serves at the default.

    See e.g. What is the difference between 0.0.0.0, 127.0.0.1 and localhost?