TL;DR
[** Jupyter Notebook **] jupyter is perfect! Is mentioned in various places, so I will omit it in this article:
Other than this Jupyter Notebook and Pythonista, there is a drawback (?) That environment construction is troublesome. You can also prepare the environment as you are told without knowing it well. However, you may have a headache later when you try to get started with Python in earnest. People who aren't Python insta often don't know Python best practices. In addition, Jupyter Notebook can run languages other than Python by using a kernel. However, for example, it is very troublesome for people who do not usually touch Ruby to set it up. People who aren't Rubyists often don't know Ruby best practices. This problem can be said in the same way when introducing any Kernel.
I feel that Docker is suitable for building an "environment that I don't understand (for myself)" like this Jupyter Notebook. So, in this paper, I will explain how to do it.
Docker Toolbox [Docker Toolbox] toolbox includes Docker Client, Docker Machine, Docker Compose, Docker Kitematic, and VirtualBox. If you want to use Docker locally, you can put this in for the time being.
If you haven't used it yet, run Docker Machine with the following command.
$ docker-machine create --driver virtualbox dev
$ eval $(docker-machine env dev)
If you look at the GitHub repo in [Jupyter Notebook] jupyter, you can see that Dockerfile is included. This time, referring to this, we will create a Dockerfile for each kernel of each language. For the time being, as a sample, I have prepared a Dockerfile containing the kernels of [Ruby] iruby-notebook and [Elixir] ielixir-notebook, so I will write a Dockerfile based on this (=> [** izumin5210) / notebook-dockerfiles **] notebook-dockerfiles).
Dockefile
FROM izumin5210/iruby-notebook
This is the basics. If you want to use some Rubygems, write gem install
in Dockerfile.
Dockefile
FROM izumin5210/iruby-notebook
RUN gem install rails
You can also prepare a Gemfile locally, copy it and bundle install
OK: ok_woman:
Gemfile
source 'https://rubygems.org'
gem 'rails'
Dockerfile
FROM izumin5210/iruby-notebook
ADD Gemfile .
RUN bundle install
After that, if you build and start this Dockerfile, you can use Jupyter Notebook.
$ docker build -t=iruby-notebook .
$ docker run -p 8888:8888 -v "$(pwd):/notebooks" iruby-notebook
If you don't want to write the docker run
option every time, you can be happy by writing docker-compose.yml
and hitting docker-compose up
.
docker-compose.yml
iruby-notebook:
build: .
ports:
- 8888:8888
volumes:
- .:/notebooks
References
Recommended Posts