我试图访问Docker容器中django extensions中使用shell_plus
命令创建的Jupyter笔记本
docker-compose -f local.yml run --rm django python manage.py shell_plus --notebook
我的配置基于@RobM和@Mark Chackerian对这个Stack Overflow question的回答。例如,我安装并配置了一个自定义内核,我的Django apps配置文件的常量NOTEBOOK_ARGUMENTS
设置为:
NOTEBOOK_ARGUMENTS = [
'--ip', '0.0.0.0',
'--port', '8888',
'--allow-root',
'--no-browser',
]
我可以在日志中看到容器已成功启动:
[I 12:58:54.877 NotebookApp] The Jupyter Notebook is running at:
[I 12:58:54.877 NotebookApp] http://10d56bab37fc:8888/?token=b2678617ff4dcac7245d236b6302e57ba83a71cb6ea558c6
[I 12:58:54.877 NotebookApp] or http://127.0.0.1:8888/?token=b2678617ff4dcac7245d236b6302e57ba83a71cb6ea558c6
但是我无法打开url。我已在我的docker-compose
中转发了8888端口,尝试使用localhost
而不是127.0.0.1
,并尝试使用容器IP,但未成功
我觉得我错过了这里显而易见的东西……感谢您的帮助
让它工作,但它为什么这样做是我无法理解的。在
docker-compose run
命令中公开端口就成功了我的印象是,在我的
local.yml
中暴露端口也会在run
开始的容器中打开它们为了到2020年的记录,我设法在{}中设置了一个工作{}设置{}:
development.py(settings.py)
requirements.txt
docker compose.yml
从主机终端运行以下命令:
最后在主机的web浏览器中导航到
http://localhost:8888/?token=<xxxx>
如果您想使用类似jupyter笔记本的独立服务:
之后:
您将在日志中获得访问令牌
相关问题 更多 >
编程相关推荐