LoginSignup
11
7

More than 5 years have passed since last update.

Windows10にDockerを入れてJupyter Notebookをコンテナで動かす

Last updated at Posted at 2018-07-24

はじめに

Google Colaboratory上でお手軽にWebスクレイピングとかしてみたかったけど、ログインが必要なページ等は無理そうなので方向を変えてWindows 10上のDockerコンテナで構築してみる。

まずは、試しにJupyter Notebookを動かしてみる。

環境

  • Windows 10 Pro (1803)

Docker for Windowsのインストール

  • 公式ページ からダウンロード
    • DockerIdが必要なので、未登録の場合は登録してからDLする
  • インストーラーを起動してインストール

Dockerの動作確認

WindowsPowerShell等で下記コマンドを実行してhello worldのイメージが起動することを確認

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
9db2ca6ccae0: Pull complete
Digest: sha256:4b8ff392a12ed9ea17784bd3c9a8b1fa3299cac44aca35a85c90c5e3c7afacdc
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/engine/userguide/

Jupyter Notebookの公式イメージからコンテナを起動

$ docker run -d -p 8888:8888 -v ${pwd}:/home/jovyan/work jupyter/scipy-notebook start-notebook.sh --NotebookApp.token=''

ブラウザでアクセス

http://localhost:8888

NotebookApp.tokenを空文字にして起動しているのでパスワード入力無しでアクセス出来ます。
また、-vでコンテナを起動したディレクトリをマウントしているので、保存したファイル等はその場所に永続化されます。

以前にGoogle Colaboratory上で動かしてみた気温グラフ表示もJupyter上で動きました。

02.png

11
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
7