在Jupyter笔记本中运行Perl 6 kernel会很棒。
我想在docker容器中运行Perl 6 notebook并在我的Web浏览器中访问它。对此我created this docker image。
创建docker镜像的代码是:
FROM sumdoc/exper2
RUN apt-get update \
&& apt-get install -y ca-certificates python3-pip && pip3 install jupyter notebook \
&& zef install Jupyter::Kernel --force-test
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"]
我在Windows 10 64 bit
,我的泊坞窗的IP地址是192.168.99.100
。
当我尝试使用以下代码运行容器时:
码头终端 docker run -it -p 8888:8888 sumdoc/perl-6-notebook
我收到此错误:
$ docker run -it -p 8888:8888 sumdoc/perl-6-notebook
[I 14:26:43.598 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.5/dist-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 1296, in initialize
self.init_webapp()
File "/usr/local/lib/python3.5/dist-packages/notebook/notebookapp.py", line 1120, in init_webapp
self.http_server.listen(port, self.ip)
File "/usr/local/lib/python3.5/dist-packages/tornado/tcpserver.py", line 142, in listen
sockets = bind_sockets(port, address=address)
File "/usr/local/lib/python3.5/dist-packages/tornado/netutil.py", line 197, in bind_sockets
sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address
任何帮助?
答案 0 :(得分:1)
您需要在Dockerfile的CMD中添加--allow-root
。您还需要将内核与dockerfile中的jupyter链接
jupyter-kernel.p6 --generate-config
一旦你这样做,你将能够看到dockerfile。我也注意到你的图像尺寸非常大,你应该尝试为jupyter而不是你拥有的图像找到更好的基本图像。
有关安装内核的更多详细信息,请参阅以下链接
https://jupyter.readthedocs.io/en/latest/install-kernel.html