I'm able to get Jupyter working just fine from a docker container, and even get Jupyter extensions working from a docker container if they're part of jupyter_contrib_nbextensions, but I can't get the jupyter-black extension working from a docker container.
Here's what I'm trying. I have a Dockerfile
that looks like this:
FROM python:3.8-slim-buster
WORKDIR /usr/src/app
RUN pip install black jupyter
# Jupyter black installation as mentioned at the bottom of
# https://github.com/drillan/jupyter-black
RUN jupyter nbextension install https://github.com/drillan/jupyter-black/archive/master.zip --user
RUN jupyter nbextension enable jupyter-black-master/jupyter-black
# Add Tini. Tini operates as a process subreaper for jupyter. This prevents
# kernel crashes.
ENV TINI_VERSION v0.6.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini
RUN chmod +x /usr/bin/tini
ENTRYPOINT ["/usr/bin/tini", "--"]
EXPOSE 8888
CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"]
From the same directory as that Dockerfile
, I run docker build . -t myjupyter
, then docker run -p 8888:8888 -it --rm myjupyter
, then open the jupyter notebook link it gives with token included. When I open a new notebook, I expect to see this Black button that I see when I install this package directly on my machine, but that button is missing when I run from docker as I described.
What's the best way to enable black formatting for jupyter notebooks from a simple docker container? Is there a different library altogether I should consider, or just a different way of installing and enabling the library I'm already trying?