Until you start Jupyter with Docker

This is the third day article of Python Advent Calendar 2015.

What do you do?

If you try to use Jupyter (IPython Notebook) including various packages on Windows or Mac, installation is difficult. So, this time, I will explain how to start Jupyter on Windows (64-bit) using Docker. Please check DockerHub for available packages. If you want to do it quickly, see [How to use Docker Toolbox](# docker-toolbox). If you want to try various things, see [How to use Docker with Ubuntu](How to use docker with #ubuntu).

How to use Docker Toolbox

By using Docker Toolbox, you can easily use Docker. After installing Docker Toolbox, you can use the following software.

--Docker Client: Operate in shell --Docker Machine: Creating a host --Docker Compose: Multiple container operation --Docker Kitematic: Operate with GUI --VirtualBox: Execution of virtual OS (CoreOS)

Install Docker Toolbox

Please download and install the installer from Docker Toolbox.

Launch Kitematic

If you use Kitematic in Docker Toolbox, you can operate Docker from the GUI. Start Kitematic. Enter [tsutomu7 / jupyter] in the search text as shown below and press the [CREATE] button. 1.png

After a while, the status will change to [RUNNING]. You can save the file on Windows by clicking [/ jupyter] under [VOLUMES] at the bottom right and selecting [Enable Volumes]. Click under [WEB PREVIEW] to start the browser and use Jupyter. 2.png

Select [Python3] from [New] on the upper right of your browser. 3.png

When [Untitled1.ipynb] opens, type "! Conda list" and press [Shift + Enter] to display a list of installed packages.

How to use Docker with Ubuntu

The following will be explained in order.

--[Install VirtualBox](Install #virtualbox) -[Install Ubuntu](Install #ubuntu) -[Register and start virtual machine](# Register and start virtual machine) -[Ubuntu settings](#ubuntu settings) -[Start Ubuntu and install Docker](Start #ubuntu and install docker) -[Start Jupyter](Start #jupyter)

VirtualBox installation

Download and install your OS installer from Download VirtualBox. Although not required, [Introduction of Extension Pack](http://vboxmania.net/content/%E3%82%A8%E3%82%AF%E3%82%B9%E3%83%86%E3% 83% B3% E3% 82% B7% E3% 83% A7% E3% 83% B3% E3% 83% 91% E3% 83% 83% E3% 82% AF% E3% 81% AE% E5% B0% It is convenient to do 8E% E5% 85% A5).

Ubuntu installation

Download the Ubuntu 14.04 LTS [^ 1] disk image from Download Virtual Hard Disk Image and unzip it.

Registering and starting a virtual machine

Start VirtualBox and press [New]. Specify as below and go to the next. 4.png

We recommend a memory size of 2048MB or more. You can change it later. For the hard disk, select [Already ...], click the icon on the right, specify the unzipped Ubuntu 14.04 LTS disk image, and click the [Create] button. 5.png

Ubuntu settings

Select Ubuntu14.04 and press [Settings]. It is convenient to set as follows in [Advanced] of [General]. 6.png

If you have installed the extension pack, you can access and use [Host IP address: 13389] on the remote desktop by setting as follows. 7.png

Select [Adapter 2] in [Network] and set as follows. Leave the settings for [Adapter 1] as they are. 8.png

For the meaning of the settings, see [Network Settings](http://vboxmania.net/content/%E3%83%8D%E3%83%83%E3%83%88%E3%83%AF%E3%83%BC See% E3% 82% AF% E8% A8% AD% E5% AE% 9A).

Booting Ubuntu and installing Docker

Press [Start] to start Ubuntu and log in.

apt update

Execute as follows. (Recommended to copy one line at a time)

ubuntu


sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo gedit /etc/apt/sources.list.d/docker.list

The editor will open, so please save as follows. 「deb https://apt.dockerproject.org/repo ubuntu-trusty main」

linux-image-extra update

Execute as follows.

ubuntu


sudo apt-get update
sudo apt-get install linux-image-extra-$(uname -r)

Docker installation

Execute as follows.

ubuntu


sudo apt-get update
sudo apt-get install docker-engine
sudo service docker start

You can check the version with "docker --version". For more information, please refer to Installation on Ubuntu.

To use docker command as non-root user

Please do the following and log in again.

ubuntu


sudo gpasswd -a $USER docker

Launch Jupyter

Start the server with Docker and check it with a browser.

Confirmation of IP address

Do the following and remember the IP address after [inet]. This address is used when opening a browser in Windows.

ubuntu


ip addr show eth1

Start Jupyter server

Just do the following:

ubuntu


mkdir jupyter
docker run -d -p 8888:8888 -v $(pwd)/jupyter:/jupyter tsutomu7/jupyter

Jupyter client confirmation

Try opening the "http: // confirmed IP address: 8888" confirmed above with a Windows browser. Python 3.5 Jupyter will start.

If you want to see it in Ubuntu browser, see "http://172.17.0.2:8888".

Jupyter server shut down

Quit the server as follows.

ubuntu


docker stop $(docker ps -aq)

Restart Jupyter server

To restart the server, follow the steps below.

ubuntu


docker start $(docker ps -aq)

[^ 1]: On October 23, 2015, Ubuntu 15.10 is the latest, but the latest long-term warranty (LTS) is 14.04.

Recommended Posts

Until you start Jupyter with Docker
Until you can do simple image recognition with Jupyter
Until you put Python in Docker
Until you start crawling in Scrapy
Until you run python with apache
Until you shake ruby with renpy
Build Jupyter Lab (Python) environment with Docker
Until you confirm iOS communication with mitmproxy
Until you can use opencv with python
Until you CI what you made with Django with Jenkins
Analytical environment construction with Docker (jupyter notebook + PostgreSQL)
Start Caddy with docker without putting Caddy in CentOS8
Until you use the Kaggle API with Colab
Start a simple Python web server with Docker
Start Nginx with docker without putting Nginx in CentOS8
Until you use PhantomJS with Python on Heroku
I tried to start Jupyter with Amazon lightsail
You can now display slides with nbviewer! [Jupyter]
Tftp server with Docker
Virtual environment construction with Docker + Flask (Python) + Jupyter notebook
Multiple selections with Jupyter
Candlestick with plotly + Jupyter
Start M5Stack with UIFlow
EC2 provisioning with Vagrant + Jupyter (IPython Notebook) on Docker
Use python with docker
Until you install MySQL-python
Proxy server with Docker
Quickly launch Jupyter with Docker (target language: Anaconda / Ruby)
Hello, World with Docker
Start IPython with virtualenv
[GitHub] Until you pull with ssh using Deploy keys
Things to do when you start developing with Django
Until you install TensorFlow-GPU with pip in Windows environment
Jupyter Docker image summary
Start today with Django
Use nim with Jupyter
Until you create Python Virtualenv on Windows and launch Jupyter
Until you can install your own Python library with pip
I want to start a jupyter environment with one command
Until you edit an SVG file with AutoCAD to PNG.
Until the start of the django tutorial with pycharm on Windows
Until API made with Flask + MySQL is converted to Docker
Embed audio data with Jupyter
Using Graphviz with Jupyter Notebook
Use pip with Jupyter Notebook
Until hello world with zappa
For those of you who don't know how to set a password with Jupyter on Docker
Implement PyTorch + GPU with Docker
PySpark life starting with Docker
Use Cython with Jupyter Notebook
Prepare python3 environment with Docker
Play with Jupyter Notebook (IPython Notebook)
Try running Python with Try Jupyter
Try Selenium Grid with Docker
Switch virtual environment with jupyter
Server management with Jupyter (1) import
Try building JupyterHub with Docker
Rails application building with Docker
How to batch start a python program created with Jupyter notebook
If you want to become a data scientist, start with Kaggle
How to use jupyter notebook without polluting your environment with Docker