问题
Binder project looks promising.
It helps in executing notebooks in a github repository by building an executable container.
I am trying to build an executable container in binder with the following Dockerfile
that has Perl 6 and Python 3 kernels:
FROM sumdoc/perl-6
ENV NB_USER jovyan
ENV NB_UID 1000
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
RUN apt-get update \
&& apt-get install -y build-essential \
git wget libzmq3-dev ca-certificates python3-pip \
&& rm -rf /var/lib/apt/lists/* && pip3 install jupyter notebook --no-cache-dir \
&& zef -v install https://github.com/bduggan/p6-jupyter-kernel.git --force-test \
&& jupyter-kernel.p6 --generate-config
ENV TINI_VERSION v0.16.1
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini
RUN chmod +x /usr/bin/tini
ENTRYPOINT ["/usr/bin/tini", "--"]
COPY . ${HOME}
USER root
RUN chown -R ${NB_UID} ${HOME}
USER ${NB_USER}
EXPOSE 8888
CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"]
Binder launches this window after building a container:
While trying to run Perl 6
or Python 3
notebook I get this error:
I read this documentation on binder but could not succeed.
What things I am missing? Any help with explanations would be appreciated.
回答1:
After going through this Dockerfile, I solved the issue.
I even wrote a blog on using Perl 6 notebook in Binder here.
What I was missing was to add WORKDIR $HOME
after USER ${NB_USER}
in my Dockerfile as follows:
FROM sumankhanal/perl-6
ENV NB_USER jovyan
ENV NB_UID 1000
ENV HOME /home/${NB_USER}
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
RUN apt-get update \
&& apt-get install -y build-essential \
git wget libzmq3-dev ca-certificates python3-pip \
&& rm -rf /var/lib/apt/lists/* && pip3 install jupyter notebook --no-cache-dir \
&& zef -v install https://github.com/bduggan/p6-jupyter-kernel.git --force-test \
&& jupyter-kernel.p6 --generate-config
ENV TINI_VERSION v0.16.1
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/bin/tini
RUN chmod +x /usr/bin/tini
ENTRYPOINT ["/usr/bin/tini", "--"]
COPY . ${HOME}
USER root
RUN chown -R ${NB_UID} ${HOME}
USER ${NB_USER}
WORKDIR ${HOME}
EXPOSE 8888
CMD ["jupyter", "notebook", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root"]
来源:https://stackoverflow.com/questions/48079802/not-able-to-serve-jupyter-notebooks-in-binder