When launching jupyter in a VM environment, the connection is refused even if the port for jupyter is set to be forwarded to localhost on the VM side.
I could have imagined that LISTEN would be something like localhost
, but I didn't know how to set it until I looked it up, so I made a note.
First, create a configuration file.
$ jupyter notebook --generate-config
By default, a file called jupyter_notebook_config.py
is created in~ / .jupyter /
.
Edit the following lines in this file.
## The IP address the notebook server will listen on.
c.NotebookApp.ip = 'localhost'
You can change this localhost
to 0.0.0.0
or *
.
## The IP address the notebook server will listen on.
c.NotebookApp.ip = '0.0.0.0'
You can now access it from outside the VM. By the way, if it's annoying that the browser starts up every time Jupyter starts up,
## Whether to open in a browser after starting. The specific browser used is
# platform dependent and determined by the python standard library `webbrowser`
# module, unless it is overridden using the --browser (NotebookApp.browser)
# configuration option.
c.NotebookApp.open_browser = False
If you set the ʻopen_browser value to
False`, you can prevent anything from opening at startup.
** Addition **
I told you in the comment section, but if you want to do ad hoc
$ jupyter notebook --ip=* --no-browser
Seems to be good. It's convenient.
Recommended Posts