LoginSignup
1
1

More than 3 years have passed since last update.

Dockerでのjupyter notebook立ち上げの手順

Last updated at Posted at 2019-08-22

Dockerでjupyter notebookに入るためにはポートの同期、マウントが必要です。
一連の流れに沿って自分が詰まった点とその解決法を共有いたします。

Dockerをローカルと紐付けて、ポートを解放して起動

docker run -it -p 8888:8888 -v $(pwd):path/to/local path/to/docker bash
8888はDockerが共有できるポート
これが8000の場合、うまくポートが共有できずVMにアクセスできない。

設定コンフィグ作成

jupyter notebook --generate-config

vimインストール(もしVM上にvimが入ってなければ)

apt-get update
apt-get install vim

vim内でコンフィグにポート解放書き込み

vi /root/.jupyter/jupyter_notebook_config.py
パスの部分は設定コンフィグ作成の時点で出たパスを入力する

設定ファイルの一番上に設定書き込み

c.NotebookApp.ip = '0.0.0.0'

jupyter起動(--allow-rootはオプション)

jupyter notebook --allow-root

Dockerの終了

ctrl + p -> ctrl + q

起動しているDockerに入る

docker exec -it container_name bash

1
1
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
1
1