Describe how to build the environment of jupyterLab using docker-compose file.
JupyterLab is an interactive development environment based on Jupyter (iPython notebook)
Create files and directories so that the configuration diagram is as shown below.
Diagram
.
├── docker-compose.yml
├── work
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=''
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!
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