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. 

No comments:

Post a Comment