如何对Jupyter实验室进行码头化

10 docker dockerfile jupyter-notebook jupyter-lab

我正在尝试将Jupyter实验室停靠,因此我尝试创建Dockerfile如下所示,

FROM python:3.6

WORKDIR /jup

RUN pip install jupyter -U && pip install jupyterlab

EXPOSE 8888

ENTRYPOINT ["jupyter", "lab"]
Run Code Online (Sandbox Code Playgroud)


和运行命令,docker build . -t jupyter然后docker run jupyter.但遗憾的是我收到了一些错误,如下所示

[I 07:56:34.123 LabApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-lab", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/usr/local/lib/python3.6/site-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.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/notebook/notebookapp.py", line 1507, in initialize
    self.init_webapp()
  File "/usr/local/lib/python3.6/site-packages/notebook/notebookapp.py", line 1297, in init_webapp
    self.http_server.listen(port, self.ip)
  File "/usr/local/lib/python3.6/site-packages/tornado/tcpserver.py", line 142, in listen
    sockets = bind_sockets(port, address=address)
  File "/usr/local/lib/python3.6/site-packages/tornado/netutil.py", line 197, in bind_sockets
    sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address
Run Code Online (Sandbox Code Playgroud)


我怎么能停靠jupyter lab?[通过解决此错误]

Nic*_*lay 12

当你开始时,jupyter lab你应该定义--ip参数.例如,--ip=0.0.0.0.

在此之后,您将有另一个错误:

[C 08:14:56.973 LabApp] Running as root is not recommended. Use --allow-root to bypass.
Run Code Online (Sandbox Code Playgroud)

所以,如果你想继续,你也需要添加--allow-root.

决赛Dockerfile是:

FROM python:3.6

WORKDIR /jup

RUN pip install jupyter -U && pip install jupyterlab

EXPOSE 8888

ENTRYPOINT ["jupyter", "lab","--ip=0.0.0.0","--allow-root"]
Run Code Online (Sandbox Code Playgroud)


Mar*_*eck 5

在四处搜索时,我遇到了这个问题,然后在 Jupyter Docker Stacks 的“阅读文档”页面中找到了对 Jupyter Labs 的引用(请参阅此处)。文档说:

JupyterLab 作为笔记本扩展预先安装,从标签 c33a7dc0eece 开始。

他们建议使用如下命令:

docker run -it --rm -p 8888:8888 jupyter/datascience-notebook start.sh jupyter lab

I thought I might as well add the reference here in case it's useful for others. (It's not immediately obvious on Docker Hub for example, that there is support for Jupyter Labs.)