[Docker] Create a jupyterLab (python) environment in 3 minutes!

Introduction

Describe how to build the environment of jupyterLab using docker-compose file.

JupyterLab is an interactive development environment based on Jupyter (iPython notebook)

Required files and directories

Directory structure

Create files and directories so that the configuration diagram is as shown below.

Diagram


.
├── docker-compose.yml
├── work
    

Contents of docker-compose.yml

Describe the necessary settings in docker-compose.yml to build the jupyterLab environment.

docker-compose.yml


version: "3"
services:
  notebook:
   # https://hub.docker.com/r/jupyter/datascience-Pull image from notebook
    image: jupyter/datascience-notebook
    #Port settings("Host: Container")
    ports:
      - "8888:8888"
    #Setting environment variables
    environment:
      - JUPYTER_ENABLE_LAB=yes
    #volume(Location of data persistence)settings of(host:container)
    #In the work directory on the host and in the container/home/jovyan/Image to which the work directory is linked
    volumes:
      - ./work:/home/jovyan/work
    #Finally, execute the command to connect to jupyterLab.
    command: start-notebook.sh --NotebookApp.token=''

starting method

After writing docker-compose.yml, execute the following command

$ docker-compose up -d

The first time it takes time to pull the image.

Once the container is up, go to http: // localhost: 8888.

Success if the screen below appears!

スクリーンショット 2020-06-21 23.24.39.png

Supplement (for those who want to start with the docker run command)

Personally, I like the method of starting using the docker-compose file, but if you have trouble creating the docker-compose file, you can also start it with the following command.

$ docker run --rm -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes -v ./work :/home/jovyan/work jupyter/datascience-notebook

At startup, the following log will appear on the console, so copy the [Token] part.

Copy/paste this URL into your browser when you connect for the first time,
  to login with a token:
  http://7dae9a493ca7:8888/?token=[token]

Go to http: // localhost: 8888.

Then, you will be asked for a password etc., so paste the token you copied earlier in the password field.

Then, the screen of jupyterLab is displayed.

Recommended Posts

[Docker] Create a jupyterLab (python) environment in 3 minutes!
Create a Python environment
Create a Vim + Python test environment in 1 minute
Create a virtual environment with conda in Python
Create a function in Python
Create a dictionary in Python
Create a Python development environment in 10 minutes (Mac OS X + Visual Studio Code)
Create a DI Container in Python
Create a Python environment on Mac (2017/4)
Create a virtual environment with Python!
Create a binary file in Python
Create a python environment on centos
Create a Kubernetes Operator in Python
Create a random string in Python
Using venv in Windows + Docker environment [Python]
Create a python environment on your Mac
Create a simple GUI app in Python
[Python] Create a virtual environment with Anaconda
[Python] Create a Batch environment using AWS-CDK
Create Python + uWSGI + Nginx environment with Docker
Create a Python-GUI app in Docker (PySimpleGUI)
[GPS] Create a kml file in Python
Introduction to docker Create ubuntu environment in ubuntu
Use WebDAV in a Portable Docker environment
Create a Python environment for professionals in VS Code on Windows
Build and try an OpenCV & Python environment in minutes using Docker
Create a C ++ and Python execution environment with WSL2 + Docker + VSCode
Create a simple Python development environment with VS Code and Docker
Create a GIF file using Pillow in Python
How to create a Python virtual environment (venv)
Ubuntu18.04.05 Creating a python virtual environment in LTS
Create a Python module
Create SpatiaLite in Python
I want to create a window in Python
Create a standard normal distribution graph in Python
How to create a JSON file in Python
[Python] Build a Django development environment with Docker
Create a python3 build environment with Sublime Text3
Build a Django environment with Vagrant in 5 minutes
Create Nginx + uWSGI + Python (Django) environment with docker
Super easy! Python + Flask environment in Docker quickly
virtual environment in python
Think about building a Python 3 environment in a Mac environment
[Venv] Create a python virtual environment on Ubuntu
Create a simple momentum investment model in Python
Work in a virtual environment with Python virtualenv.
Create a new page in confluence with Python
Create a datetime object from a string in Python (Python 3.3)
Use jupyter-lab installed in python virtual environment (venv)
Development environment in Python
Create a MIDI file in Python using pretty_midi
Create a loop antenna pattern in Python in KiCad
Create a Python execution environment on IBM i
Create a Python virtual development environment on Windows
Create a Django project and application in a Python virtual environment and start the server
Create a data collection bot in Python using Selenium
Japanese can be used with Python in Docker environment
Building a Docker working environment for R and Python
[LINE Messaging API] Create a rich menu in Python
Create a plugin to run Python Doctest in Vim (2)
Create a comfortable Python 3 (Anaconda) development environment on windows