在Docker的后台运行Jupyter Notebook [英] Run Jupyter Notebook in the Background on Docker

查看:573
本文介绍了在Docker的后台运行Jupyter Notebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在后台运行jupyter笔记本,而无需在控制台上打印任何内容.我在针对bash的问题中找到了该解决方案:

jupyter notebook &> /dev/null &

但是我正在docker容器中运行jupyter,并希望它通过CMD在后台启动.我该如何在sh中做同样的事情?

解决方案

我使用以下设置中的设置使它起作用:
以在启动时在后台运行jupyter的情况下启动容器.

I am trying to run a jupyter notebook in the background without printing anything to the console. I found this solution in a question for bash:

jupyter notebook &> /dev/null &

But I am running jupyter in a docker container and want it to start in the background via CMD. How can I do the same in sh?

解决方案

I got it to work using the setup from:
https://github.com/jupyter/docker-stacks/tree/master/minimal-notebook

the trick was to install tini and put the following code into a start-notebook.sh script:

#!/bin/bash
exec jupyter notebook &> /dev/null &

this is than added to the path with:
COPY start-notebook.sh /usr/local/bin/ and
RUN chmod +x /usr/local/bin/start-notebook.sh

Then I could set CMD ["start-notebook.sh"] to start up the container with jupyter running in the background on start.

这篇关于在Docker的后台运行Jupyter Notebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆