How to touch Jupyter Notebook without polluting the environment other than Pythonista, or how to touch Ruby with Jupyter Notebook without polluting the environment other than Rubyist

TL;DR

About Jupyter Notebook

[** 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)

Run Jupyter Notebook with Docker

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

How to touch Jupyter Notebook without polluting the environment other than Pythonista, or how to touch Ruby with Jupyter Notebook without polluting the environment other than Rubyist
How to use jupyter notebook without polluting your environment with Docker
How to debug with Jupyter or iPython Notebook
How to easily create an environment where python code runs on Jupyter without polluting the local environment
How to use jupyter notebook with ABCI
[linux] How to quit without waiting for the other party to disconnect with telnet
How to quickly create a machine learning environment using Jupyter Notebook with UbuntuServer 16.04 LTS
How to instantly launch Jupyter Notebook from the terminal
Run the program without building a Python environment! !! (How to get started with Google Colaboratory)
How to quickly create a machine learning environment using Jupyter Notebook with UbuntuServer 16.04 LTS with anaconda
How to run Python on Windows without polluting the environment as much as possible (Scoop edition)
How to deal with the terminal getting into the pipenv environment without permission when using pipenv with vscode
Reflect the virtual environment created with Miniconda in Jupyter notebook
How to extract other than a specific index with Numpy
I want to use a virtual environment with jupyter notebook!
How to see the contents of the Jupyter notebook ipynb file
The usual way to add a Kernel with Jupyter Notebook
Connect the Jupyter Notebook kernel to Spyder with Jupytext enabled
How to get into the python development environment with Vagrant
How to use Jupyter Notebook
How to quickly create a machine learning environment using Jupyter Notebook on macOS Sierra with anaconda
How to batch start a python program created with Jupyter notebook
[Python] How to get a value with a key other than value with Enum
How to build Python and Jupyter execution environment with VS Code
I wanted to use jupyter notebook with docker in pip environment (opticspy)
Specify the browser to use with Jupyter Notebook. Especially Mac. (And Vivaldi)
Prepare a development environment that is portable and easy to duplicate without polluting the environment with Python embeddable (Windows)
I want to blog with Jupyter Notebook
How to execute commands in jupyter notebook
Jupyter Notebook Basics of how to use
How to use Jupyter notebook [Super Basic]
How to publish a blog on Amazon S3 with the static Blog engine'Pelican'for Pythonista
To output a value even in the middle of a cell with Jupyter Notebook
How to deal with "No module named'〇〇'" error in Jupyter Notebook | Install with! Pip!
A memorandum of how to execute the! Sudo magic command in Jupyter Notebook
If you want to enter the virtual environment with jupyter, nb_conda_kernels is recommended
How to make the font width of jupyter notebook put in pyenv equal width