Create jupyter notebook with Docker and run ruby

A memorandum when running jupyter notebook with Docker

environment

flow

First, create a Dockerfile

mkdir ~/jupyter
cd ~/jupyter
touch Dockerfile
vim Dockerfile

Dockerfile


FROM python:3
USER root

RUN apt update && \
    apt -y install jupyter-notebook
ENV LANG ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja
ENV LC_ALL ja_JP.UTF-8
ENV TZ JST-9

CMD ["jupyter-notebook", "--port", "8000", "--ip=0.0.0.0", "--allow-root"]

build docker

docker build -t jupyter .

docker container start

docker run --rm -p 8001:8000 jupyter 

Move

http://127.0.0.1:8001/?token=~ Jupyter notebook works when connected to

Make ruby work

Modify the Dockerfile as iruby is required

Dockerfile


FROM python:3
USER root

RUN apt update && \
    apt -y install jupyter-notebook ruby ruby-ffi-rzmq && \
    gem install iruby && \
    iruby register --force
ENV LANG ja_JP.UTF-8
ENV LANGUAGE ja_JP:ja
ENV LC_ALL ja_JP.UTF-8
ENV TZ JST-9

CMD ["jupyter-notebook", "--port", "8000", "--ip=0.0.0.0", "--allow-root"]

ruby works with jupyter notebook

You can now select ruby from new in jupyter notebook -> It works. Yay

Other

The following error occurs without ruby-ffi-rzmq

[I 15:26:42.550 NotebookApp] Kernel started: 70bcadba-f259-40b4-9fd0-1ea479195b0e
F, [2020-06-07T15:26:43.232174 #9] FATAL -- : Kernel died: uninitialized constant IRuby::SessionAdapter::PyzmqAdapter::PyCall
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter/pyzmq_adapter.rb:7:in `rescue in load_requirements'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter/pyzmq_adapter.rb:4:in `load_requirements'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:7:in `available?'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:63:in `block in select_adapter_class'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:62:in `each_value'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:62:in `select_adapter_class'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session.rb:112:in `create_session_adapter'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session.rb:12:in `initialize'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:17:in `new'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:17:in `initialize'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/command.rb:110:in `new'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/command.rb:110:in `run_kernel'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/command.rb:40:in `run'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/bin/iruby:5:in `<top (required)>'
/usr/local/bin/iruby:23:in `load'
/usr/local/bin/iruby:23:in `<main>'
Traceback (most recent call last):
	15: from /usr/local/bin/iruby:23:in `<main>'
	14: from /usr/local/bin/iruby:23:in `load'
	13: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/bin/iruby:5:in `<top (required)>'
	12: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/command.rb:40:in `run'
	11: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/command.rb:110:in `run_kernel'
	10: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/command.rb:110:in `new'
	 9: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:17:in `initialize'
	 8: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:17:in `new'
	 7: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session.rb:12:in `initialize'
	 6: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session.rb:112:in `create_session_adapter'
	 5: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:62:in `select_adapter_class'
	 4: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:62:in `each_value'
	 3: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:63:in `block in select_adapter_class'
	 2: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:7:in `available?'
	 1: from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter/pyzmq_adapter.rb:4:in `load_requirements'
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter/pyzmq_adapter.rb:7:in `rescue in load_requirements': uninitialized constant IRuby::SessionAdapter::PyzmqAdapter::PyCall (NameError)

Recommended Posts

Create jupyter notebook with Docker and run ruby
Write DiscordBot to Spreadsheets Write in Ruby and run with Docker
Run Pico with docker
Run Payara with Docker
[Introduction to Docker] Create a Docker image for machine learning and use Jupyter notebook
Run Mosquitto with Docker and try WebSocket communication with MQTT
Run TAO Core with Docker
Run Rails whenever with docker
Maybe it works! Create an image with Docker and share it!
Create Rails5 and postgresql environment with Docker and make pgadmin available
Create a Vue3 environment with Docker!
Run lambda with custom docker image
Run SQL Server with Docker ToolBox
Hello World with Docker and C
Create SolrCloud verification environment with Docker
Create Laravel environment with Docker (docker-compose)
2. Create Docker image and register Registry
Make JupyterLab run anywhere with docker
Microservices With Docker and Cloud Performance
Create a flyway jar with maven and docker build (migrate) with docker-maven-plugin
With ruby ● × Game and Othello (basic review)
Create an infinite scroll with Infinite Scroll and kaminari
Building Rails 6 and PostgreSQL environment with Docker
Create Rails 6 + MySQL environment with Docker compose
Create a MySQL environment with Docker from 0-> 1
Create Spring Boot-gradle-mysql development environment with Docker
[Docker] Create Node.js + express + webpack environment with Docker
Communicate Gitlab and Gitlab Runner launched with Docker
[Docker] Build Jupyter Lab execution environment with Docker
Create external (URL) monitoring with Docker + Prometheus
Run Ubuntu + ROS with Docker on Mac
How to run Blazor (C #) with Docker
Install Docker and create Java runtime environment
Convert JSON to TSV and TSV to JSON with Ruby
Create an ARM-cpu environment with qemu on mac and run java [Result → Failure]
Build a development environment to create Ruby on Jets + React apps with Docker
Introducing a dark Jupyter Notebook with pyenv and Vim keybindings on Ubuntu on WSL 2
Sample to create PDF from Excel with Ruby
Experience .NET 5 with Docker and Visual Studio Code
[Ruby] Arguments with keywords and default values of arguments
Introducing Rspec with Ruby on Rails x Docker
I implemented Ruby with Ruby (and C) (I played with builtin)
Try to link Ruby and Java with Dapr
Run JSP Hello World with Tomcat on Docker
Solving with Ruby and Crystal AtCoder ABC 129 D
Prepare a scraping environment with Docker and Java
Create a Spring Boot development environment with docker
Create a Java (Gradle) project with VS Code and develop it on a Docker container
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (5)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (3)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (2)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (1)
[Rails AWS Docker] Build an existing Ruby on Rails + MySQL application with Docker and deploy it on AWS (4)
Docker command to create Rails project with a single blow in environment without Ruby
Ruby and Gem
Create a Java (Maven) project with VS Code and develop it on a Docker container
Build Elastic Stack with Docker and analyze IIS logs
Feel the basic type and reference type easily with ruby
Run old Vivado with Docker guest OS as CentOS 7.4
Solving with Ruby and Java AtCoder ABC129 D 2D array
[Ruby] Exclude and replace specific patterns with regular expressions