简体   繁体   English

Docker 映像构建失败。 Jupyter 命令“nbconvert”找不到 ipython notebook

[英]Docker image build fails. Jupyter command "nbconvert" cannot find ipython notebook

I have created a Dockerfile with the purpose of executing a Jupyter notebook inside Docker.我创建了一个 Dockerfile,目的是在 Docker 中执行 Jupyter notebook。 It looks like the following看起来像下面这样

FROM ubuntu:latest

RUN apt-get update && apt-get install -y python3 \
    python3-pip

RUN pip3 install jupyter

WORKDIR /home/me/JupyterOneClick/
RUN pwd

RUN jupyter nbconvert --to python Hello.ipynb
RUN python Hello.py
#CMD ["python","Hello.py"]

But, i am given an error when building this image (docker build -t jupyter:latest .)但是,在构建此映像时出现错误(docker build -t jupyter:latest 。)

Step 6 converts the jupyter notebook to a python file, and step 7 executes that python file.步骤 6 将 jupyter notebook 转换为 python 文件,步骤 7 执行该 python 文件。

Step 6/7 : RUN jupyter nbconvert --to python Hello.ipynb ---> Running in 8516a27588f6 [NbConvertApp] WARNING |步骤 6/7:运行 jupyter nbconvert --to python Hello.ipynb ---> 在 8516a27588f6 中运行 [NbConvertApp] 警告 | pattern 'Hello.ipynb' matched no files This application is used to convert notebook files (*.ipynb) to various other formats.模式 'Hello.ipynb' 不匹配任何文件 此应用程序用于将笔记本文件 (*.ipynb) 转换为各种其他格式。

The jupyter notebook is stored in /home/me/JupyterOneClick. jupyter 笔记本存储在 /home/me/JupyterOneClick 中。

At this point, the build process stops.此时,构建过程停止。

I also tried to move step 6 and 7 into a shell script, and run the script from Dockerfile, through which i am able to build the image, but cannot run it, as it cannot find the shell script.我还尝试将步骤 6 和 7 移到 shell 脚本中,并从 Dockerfile 运行脚本,通过它我可以构建映像,但无法运行它,因为它找不到 shell 脚本。

The command '/bin/sh -c chmod +x ./script.sh' returned a non-zero code: 1命令“/bin/sh -c chmod +x ./script.sh”返回一个非零代码:1

Can anyone tell me how do i fix this?谁能告诉我如何解决这个问题? I am a beginner, but from what i can understand, RUN creates a new temporary container because of which it is not able to find the file.我是初学者,但据我所知,RUN 创建了一个新的临时容器,因此无法找到该文件。

For anyone who is wondering, i am not using kubeflow or JupyterHub as they allow for a new development enviromnment, and i have to deploy an existing notebook.对于任何想知道的人,我不使用 kubeflow 或 JupyterHub,因为它们允许新的开发环境,而且我必须部署现有的笔记本。

Im not an expert but it seems like you forgot the copy statement.我不是专家,但您似乎忘记了复制声明。 Use COPY ./Hello.ipynb /Hello.ipynb and instead of -- to python you should use -- to script使用COPY ./Hello.ipynb /Hello.ipynb而不是-- to python你应该使用-- to script

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何帮助 Python 找到 Jupyter 命令“jupyter-nbconvert”,将 Jupyter Notebook 导出为 HTML? - How do I help Python find Jupyter command 'jupyter-nbconvert', to export Jupyter Notebook to HTML? VScode 无法将 Jupyter 笔记本导出到 HTML - 未找到“jupyter-nbconvert” - VScode fails to export Jupyter notebook to HTML - 'jupyter-nbconvert` not found Jupyter(iPython)笔记本说“找不到与Python [Root]匹配的内核” - Jupyter (iPython) notebook says “cannot find a kernel matching Python [Root]” 在 jupyter ipython notebook 上导入熊猫失败 - Import pandas on jupyter ipython notebook fails 将jupyter笔记本转换为pdf(彩色) - nbconvert jupyter notebook to pdf (with color) 无法使用ipython / jupyter笔记本导入matplotlib - Cannot import matplotlib with ipython/jupyter notebook 无法创建新的ipython笔记本或启动jupyter - Cannot create new ipython notebook or start jupyter 使用 jupyter nbconvert 在不同的目录中运行 jupyter notebook - Run a jupyter notebook in a different directory with jupyter nbconvert Python-IPython Notebook无法找到Java可执行文件 - Python - IPython Notebook fails to find the Java executable Jupyter notebook 找不到模块 - Jupyter notebook cannot find module
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM