【问题标题】:Running nbdiff-web from a Docker container从 Docker 容器运行 nbdiff-web
【发布时间】:2018-09-11 14:49:56
【问题描述】:

我正在尝试从 docker 容器中使用 nbdime 的 nbdiff-web。当我跑步时

$ nbdiff-web 5e035626bac76eba78548157ddf9dd3fac8cfd5f 40d4652fff52743ca445034876446cc0933d5f24

我回来了

[I nbdimeserver:375] Listening on 127.0.0.1, port 39843
[W webutil:18] No web browser found: could not locate runnable browser.
[I webutil:29] URL: http://127.0.0.1:39843/difftool

显然,我无法访问该 URL,因为在我的 Dockerfile 上我没有公开该端口。

Dockerfile

FROM jupyter/scipy-notebook

USER root

# Copy the git config file
COPY gitconfig /home/jovyan/.gitconfig

# bash instead of dash to use source
RUN ln -snf /bin/bash /bin/sh

# These require sudo so they must come before defining
# a user
RUN sudo apt-get update

# Install ssh
RUN sudo apt-get -y install openssh-server
RUN sudo apt-get -y install curl

# Install the tree command
RUN sudo apt-get install tree

USER jovyan

# Install additional python packages
RUN pip install --upgrade pip \
 && pip install autopep8 \
 && pip install gspread \
 && pip install isort \
 && pip install jupyter_contrib_nbextensions \
 && pip install nbimporter \
 && pip install nbdime \
 && pip install oauth2client \
 && pip install pathlib \
 && pip install selenium \
 && nbdime extensions --enable

RUN jupyter contrib nbextension install --user

# Enable Jupyter extensions by default
RUN jupyter nbextension enable autosavetime/main \
 && jupyter nbextension enable jupyter-autopep8-master/jupyter-autopep8 \
 && jupyter nbextension enable codefolding/edit \
 && jupyter nbextension enable code_prettify/isort \
 && jupyter nbextension enable scratchpad/main \
 && jupyter nbextension enable splitcell/splitcell \
 && jupyter nbextension enable table_beautifier/main \
 && jupyter nbextension enable code_prettify/2to3 \
 && jupyter nbextension enable init_cell/main \
 && jupyter nbextension enable nbextensions_configurator/tree_tab/main \
 && jupyter nbextension enable spellchecker/main \
 && jupyter nbextension enable toc2/main \
 && jupyter nbextension enable toggle_all_line_numbers/main \
 && jupyter nbextension enable varInspector/main

# Enable nbdime by default
RUN nbdime config-git --enable --global

# Create two dirs to mount volumes
RUN cd /home/jovyan && rm -rf work && mkdir dev && mkdir filestream

我也不知道 nbdiff-web 将在哪个端口上启动,这使得在 Dockerfile 中选择要公开的端口变得更加困难(为此,我尝试使用解决方案 here,但返回了授权错误)。

我怎样才能做到这一点?

【问题讨论】:

    标签: docker jupyter-notebook dockerfile


    【解决方案1】:

    已经有一段时间了,但对于任何感兴趣的人,我都遇到了同样的问题,并将 IP 标志设置为 0.0.0.0 为我解决了这个问题:

    nbbdiff-web -p 3000 --ip 0.0.0.0
    

    这是我得到这个想法的仓库:https://github.com/trallard/JNB_reproducible/blob/b7d400f2145b2e2886de465a6983e0e172dac002/bash_aliases

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-19
      • 2022-10-04
      • 2019-05-16
      • 2018-10-10
      • 1970-01-01
      • 1970-01-01
      • 2017-02-21
      • 1970-01-01
      相关资源
      最近更新 更多