我创建了一个安装了Jupyter Lab的docker镜像,用于机器学习环境进行本地开发。
为避免在容器中使用root用户,我在容器中使用了与本地主机相同的uid。
我设法通过以下命令在容器中启动Jupyter Lab:
{"@context":"http://schema.org","@type":"LocalBusiness","name":"Clínica Dental Castellana 23","description":".TU CLÍNICA DENTAL DE REFERENCIA EN MADRID","telephone":"+34912298837","address":{"@type":"PostalAddress","streetAddress":"Castellana 23","addressLocality":"MADRID","addressRegion":"Madrid","postalCode":"28003"}}
但是,我无法更改Jupyter Lab的主题。并报告以下错误:
Jupyter lab --ip=0.0.0.0 --port=8888
容器中甚至不存在目录“ /.jupyter”。
如何解决此问题并将主题更改为黑暗?谢谢!
以下是必要的补码
我的Dockerfile:
[W 14:02:12.974 LabApp] 500 PUT /lab/api/settings/@jupyterlab/apputils-extension:themes?1572184932897 (172.17.0.1): Failed writing settings (@jupyterlab/apputils-extension:themes): [Errno 13] Permission denied: '/.jupyter'
[W 14:02:12.975 LabApp] Failed writing settings (@jupyterlab/apputils-extension:themes): [Errno 13] Permission denied: '/.jupyter'
[E 14:02:12.975 LabApp] {
"Host": "127.0.0.1:8888",
"Pragma": "no-cache",
"Accept": "*/*",
"Authorization": "token bbe0ea37f1d54cd21cac85350cf81f7ab831d298ff2ce9ba",
"X-Xsrftoken": "2|4e33c1b7|8b2a94f61a038e400b6f1d672c8ad95c|1572182770",
"Accept-Language": "en-gb",
"Cache-Control": "no-cache",
"Accept-Encoding": "gzip, deflate",
"Content-Type": "application/json",
"Origin": "http://127.0.0.1:8888",
"Content-Length": "237",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.2 Safari/605.1.15",
"Referer": "http://127.0.0.1:8888/lab",
"Connection": "keep-alive",
"Cookie": "username-127-0-0-1-8888=\"2|1:0|10:1572184913|23:username-127-0-0-1-8888|44:MGMzNzJmNDAwOWQ3NDQzOWI1ZDgzOTY5ZTUzYTI4NjQ=|e2e38e0740c172241ffd8d95316bbe453cc40fd4e03e8f6530593d746f8d9037\"; _xsrf=2|4e33c1b7|8b2a94f61a038e400b6f1d672c8ad95c|1572182770"
}
[E 14:02:12.975 LabApp] 500 PUT /lab/api/settings/@jupyterlab/apputils-extension:themes?1572184932897 (172.17.0.1) 8.73ms referer=http://127.0.0.1:8888/lab
requirement.txt:
FROM tensorflow/tensorflow:latest-gpu-py3-jupyter AS pre
WORKDIR /repo
RUN apt-get -qqy update && apt-get install -qqy \
curl \
npm \
nodejs
FROM pre AS dev
COPY ./* /repo/
RUN pip install --upgrade pip && pip install -r requirement.txt
RUN jupyter labextension install @jupyterlab/toc
RUN chmod -R 777 /.local
我如何运行容器:
pandas
scipy
scikit-learn
matplotlib
seaborn
jupyterlab
答案 0 :(得分:1)
启动Jupyter时,请使用-notebook-dir
开关为笔记本指定主目录。 Jupyter将需要使用您选择使用的用户ID对该目录进行写访问。 .jupyter目录将自动创建,并将存储Jupyter环境的配置选项。
最好选择一个子目录,然后使用run命令将其挂载到容器中。请注意,将在.jupyter目录中创建一个jupyter_notebook_config.py文件,其中包含许多您可能希望调整的选项。例如,c.NotebookApp.allow_remote_access = False
可能适合您的情况。