SolomSong
SolomSong

Reputation: 306

Can't access jupyter notebook in local vagrant virtualbox via local browser

As the title described. I already set the Vagrantfile with:

config.vm.network "forwarded_port", guest: 8888, host: 8888, auto_correct: true

and also set the jupyter_notebook_config.py as:

c.NotebookApp.port = 8888

When I activate the notebook in vagrant virtualbox the displayed info was normal:

enter image description here

But local browser (Safari) can't access to it by any means.

enter image description here

Upvotes: 3

Views: 2028

Answers (2)

Alban K
Alban K

Reputation: 51

I stumbled on a issue that seems similar. Here is what solved it for me:

  • In the Vagrantfile, I added:

    config.vm.network "private_network", ip: "192.168.33.10"

  • From the vagrant virtual machine start jupyter notebook with:

    jupyter notebook --no-browser --ip 0.0.0.0

  • Or in the browser of the host access jupyter via 192.168.33.10:8888

Upvotes: 4

Frederic Henri
Frederic Henri

Reputation: 53733

Your issue is that the server is listening on localhost in the VM so it is only available within the VM.

If you want the server to be available from your host, you should bind the ip to 0.0.0.0

see this thread to understand the differences

Adding the following in your config will do the trick

c.NotebookApp.ip = '0.0.0.0'

Upvotes: 3

Related Questions