gpt4 book ai didi

docker - 如何 docker 化 Jupyter 实验室

转载 作者:IT老高 更新时间:2023-10-28 21:20:18 26 4
gpt4 key购买 nike

我正在尝试将 Jupyter Lab docker 化所以我尝试创建一个 Dockerfile 如下,

FROM python:3.6

WORKDIR /jup

RUN pip install jupyter -U && pip install jupyterlab

EXPOSE 8888

ENTRYPOINT ["jupyter", "lab"]


并运行命令 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


我如何 dockerize jupyter lab ? [通过解决这个错误]

最佳答案

当你启动 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.

所以,如果你想继续,你还需要添加 --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"]

关于docker - 如何 docker 化 Jupyter 实验室,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49024624/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com