How to run JupyterLab on Docker

Jupyter and JupyterLab are great tools for data science. Sometimes it is more convenient to simply run them with Docker as containers, which can be easily stopped and deleted after use.

Selecting the image

Jupyter has a lot of images at Doc…


This content originally appeared on DEV Community and was authored by Juan Belieni

Jupyter and JupyterLab are great tools for data science. Sometimes it is more convenient to simply run them with Docker as containers, which can be easily stopped and deleted after use.

Selecting the image

Jupyter has a lot of images at Docker Hub. Fortunately, Jupyter documentation covers this topic very well. Here, I will use the jupyter/datascience-notebook image, which "includes libraries for data analysis from the Julia, Python, and R communities".

Running with Docker Compose

I particularly like to create a Docker Compose file for each service I use with Docker, because it is better to manage all the necessary options.

First, you have to map the port of the service to a port at your computer. I recommend using the same default port as Jupyter.

jupyter:
  image: jupyter/datascience-notebook:latest
  container_name: jupyter
  ports:
    - 8888:8888

Now, it will just be necessary to define two environment variables, JUPYTER_ENABLE_LAB and JUPYTER_TOKEN. Here, you can define the most convenient token for you.

jupyter:
  image: jupyter/datascience-notebook:latest
  container_name: jupyter
  ports:
    - 8888:8888
  environment:
    JUPYTER_ENABLE_LAB: "yes"
    JUPYTER_TOKEN: "docker"

Finally, just run the Docker Compose command to start your container.

docker-compose up

Running from Docker CLI

If you prefer to run this container from Docker CLI, just copy and paste this command.

docker run -p 8888:8888 \
           -e JUPYTER_ENABLE_LAB=yes \
           -e JUPYTER_TOKEN=docker \
           --name jupyter \
           -d jupyter/datascience-notebook:latest

Accessing JupyterLab

At your browser, just enter http://localhost:8888 and provide the token defined by you.


This content originally appeared on DEV Community and was authored by Juan Belieni


Print Share Comment Cite Upload Translate Updates
APA

Juan Belieni | Sciencx (2021-10-07T23:14:25+00:00) How to run JupyterLab on Docker. Retrieved from https://www.scien.cx/2021/10/07/how-to-run-jupyterlab-on-docker/

MLA
" » How to run JupyterLab on Docker." Juan Belieni | Sciencx - Thursday October 7, 2021, https://www.scien.cx/2021/10/07/how-to-run-jupyterlab-on-docker/
HARVARD
Juan Belieni | Sciencx Thursday October 7, 2021 » How to run JupyterLab on Docker., viewed ,<https://www.scien.cx/2021/10/07/how-to-run-jupyterlab-on-docker/>
VANCOUVER
Juan Belieni | Sciencx - » How to run JupyterLab on Docker. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/10/07/how-to-run-jupyterlab-on-docker/
CHICAGO
" » How to run JupyterLab on Docker." Juan Belieni | Sciencx - Accessed . https://www.scien.cx/2021/10/07/how-to-run-jupyterlab-on-docker/
IEEE
" » How to run JupyterLab on Docker." Juan Belieni | Sciencx [Online]. Available: https://www.scien.cx/2021/10/07/how-to-run-jupyterlab-on-docker/. [Accessed: ]
rf:citation
» How to run JupyterLab on Docker | Juan Belieni | Sciencx | https://www.scien.cx/2021/10/07/how-to-run-jupyterlab-on-docker/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.