Skip to content

Instantly share code, notes, and snippets.

@skitazaki
Last active July 2, 2016 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skitazaki/08704150f8e05364e9541343db9e84f2 to your computer and use it in GitHub Desktop.
Save skitazaki/08704150f8e05364e9541343db9e84f2 to your computer and use it in GitHub Desktop.
Jupyter on Vagrant

Jupyter notebook on Vagrant

Boot vagrant box and login using ssh.

$ [ -d notebook ] || mkdir notebook
$ vagrant up
$ vagrant ssh

Run docker image in the vagrant box.

$ NOTEBOOK_PASSWORD="SECRET_PASSWORD"
$ sudo docker run -d --name notebook -p 8080:8888 \
      -v /vagrant:/home/jovyan/work \
      -e USE_HTTPS=yes -e PASSWORD=$NOTEBOOK_PASSWORD \
      jupyter/datascience-notebook

Visit 8080 port from the host machine.

# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.synced_folder "./notebook", "/vagrant"
config.vm.provider "virtualbox" do |vb|
vb.name = "jupyter"
vb.memory = "1024"
end
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
curl -sSL https://get.docker.com/ | sudo sh
sudo usermod -aG docker ubuntu
sudo docker pull jupyter/datascience-notebook
sudo curl -L https://github.com/docker/compose/releases/download/1.7.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
SHELL
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment