Saturday, August 7, 2021

C++ in Jupyter Docker

Now, you can run C++ code snippets in Jupyter Nottebook.

Docker File

FROM frolvlad/alpine-miniconda3

RUN conda install -y -c conda-forge bash jupyter jupyterlab jupyter_contrib_nbextensions

RUN conda install -y -c conda-forge xeus-cling xtensor xwidgets widgetsnbextension

RUN apk update

RUN apk add nodejs npm

RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager

RUN mkdir /work 

WORKDIR /work

CMD jupyter notebook --allow-root --ip 0.0.0.0

 

Building Docker

docker build --rm -t jupyter-cpp .

Running Docker

docker run -p 8888:8888 -it -d -e JUPYTER_ENABLE_LAB=yes -v <your dir>:/work --name <docker-name> jupyter-cpp

Use the "docker logs <docker-name>" command to get the URL & Token for the Jupyter Notebook.

It supports C++11, C++14 & C++17. 

Thursday, June 24, 2021

Dockers for Jupyter Notebook

 Docker are like mini-Vms but without any kernel of its own and shares the host's kernel. Dockers are implemented based the Linux Kernel virtualization tools like Namespaces & C-Groups.

In the past few days I was trying to install and run Jupyter Notebook in my Windows PC, it has become increasingly frustrating as it takes a lot of time to install and has lot of other shortcoming.

Finally, I gave up installing Jupyter Notebook on my Windows PC, instead I used Docker to install the Jupyter Notebook in my Linux Mint Virtual Machine.

The best and easy way to run Jupyter Notebook Docker is by the following command:

docker run -p 10000:8888 -d -e JUPYTER_ENABLE_LAB=yes -v <your-work-dir>:/home/jovyan/work --name myjupyter jupyter/datascience-notebook

Use the "docker logs <docker-name>" command to get the URL & Token for the Jupyter Notebook.