python-3.x - 无法在 Binder 中提供 jupyter 笔记本

标签 python-3.x docker jupyter-notebook raku

Binder项目看起来很有希望。
它通过构建可执行容器来帮助在 github 存储库中执行笔记本。
我正在尝试使用以下 Dockerfile 在活页夹中构建一个可执行容器有 Perl 6 Python 3 内核:

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 启动此窗口:
enter image description here

尝试运行时 Perl 6Python 3笔记本我收到此错误:
enter image description here

我读了这个 documentation on binder但没能成功。

我缺少什么东西?任何有关解释的帮助将不胜感激。

最佳答案

经过this Dockerfile ,我解决了这个问题。

我什至在 Binder here 写了一篇关于使用 Perl 6 notebook 的博客.

我缺少的是添加 WORKDIR $HOME之后 USER ${NB_USER}在我的 Dockerfile 中,如下所示:

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"]

关于python-3.x - 无法在 Binder 中提供 jupyter 笔记本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48079802/

相关文章:

python - 为什么我安装不了mysqlclient==1.3.10

nginx - 构建nginx docker时出错

php - 如何授予对PaaS(Symfony CLoud)目录的访问权限?

python - 无法从 anaconda 打开 jupyter 笔记本

python - Jupyter Notebook 中未定义名称 'KMeans'

python - Jupyter Lab/Notebook 魔法命令 %load 具有与平台无关的路径

python - Python 3 中的过滤对象错误

python - 从带有分数的字典创建有向图

python - "raise"的范围在 Python 2 和 3 的嵌套异常处理程序中没有参数

mysql - [ docker ] : Connecting PHPMyAdmin to MySQL doesnt work