1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

1コマンドでjupyter環境を立ち上げたい

1
Last updated at Posted at 2020-05-20

はじめに

Python環境を構築していない人に、「Jupyter開いてみて!」ってお願いすることがまれにあります。

そのときに、

  • pyenvのinstall
  • python3のinstall
  • pandas, Jupyterのinstall

などをお願いするのがとてもしんどいです。(たまに意図しないエラーでることもあるので)

Dockerを使おう!

Dockerが入っている前提ですが、Dockerが入っていれば1コマンドで立ち上がります

※ macOSの場合、Dockerのinstallはこの記事あたりを参考に!brewですぐinstallできます

Homebrew で macOS に Docker をインストールして Hello world

DockerでJupyterを立ち上げてアクセスする方法

Dockerのimageは
https://hub.docker.com/r/jupyter/datascience-notebook/
から拝借します。pandasなど必要なライブラリがほぼ入っているので、容量は食うもののストレスレスで分析・描画できます。

以下Usage.

docker run -d --name notebook -v $PWD:/home/jovyan -p 9999:8888 jupyter/datascience-notebook
docker logs notebook 2>&1 | grep 'http://127.0.0.1:8888/?token=' 2>&1 | sed -e "s/^.*token=\(.*\).*$/\1/" 2>&1 | sed -n -e \$p
  • Dockerコンテナを落として削除(使い終わったら消しといたほうがいい)
docker stop notebook && docker rm notebook
  • Dockerで使ってないコンテナやイメージを全整理(削除)する(ストレージ食うので)
docker system prune

Dockerのゴミ削除

Dockerを使った環境作りの際、いろいろ試行錯誤しているとゴミがたまり、稀に50GBくらい食ってることがあります。
基本docker system pruneを定期的にしていれば大丈夫ですが、ここあたりの記事も参考に!

Docker一括削除コマンドまとめ

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?