我正在尝试从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中选择EXPOSE的端口更加困难(为此,我尝试使用解决方案here,但获得了授权错误返回)。
我该如何实现?
答案 0 :(得分: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