如何从Dask Jupyter笔记本中保留笔记本?

时间:2020-07-10 03:30:51

标签: python docker docker-compose jupyter-notebook dask

我正在运行Docker撰写文件(docker-compose up --force-recreate),以启动Dask调度程序,工作程序和Dask Jupyter笔记本。我添加了以下卷:

  notebook:
    image: daskdev/dask-notebook
    depends_on:
      - scheduler
      - worker
    ports:
      - "8888:8888"
    environment:
      DASK_SCHEDULER_ADDRESS: "tcp://scheduler:8786"
    volumes:
      - "~/Personal/python-workspace/notebooks:/home/jovyan/work"
      - "~/Personal/docker-volumes/tmp:/tmp"

每当我尝试在work文件夹下创建文件时,都会在终端上获得HTTP 403,其中包含以下日志:

notebook_1   | [I 03:28:19.584 LabApp] Saving file at /Untitled.ipynb
notebook_1   | [I 03:28:35.668 LabApp] Creating new file in /work
notebook_1   | [W 03:28:35.670 LabApp] Permission denied: work/untitled.txt

如何解决这个问题并保存笔记本?

1 个答案:

答案 0 :(得分:0)

在主机上(docker容器外部),这应该可以工作,并且可以避免出现 Denied错误

sudo chmod -R 777 ~/Personal/python-workspace/notebooks

但这不是解决错误的正确方法,由于daskdev/dask-notebook是基于jupyter/base-notebook的,因此您应该参考this documentation

参考此URL,我认为在您的docker-compose文件中添加这些环境变量应该可以解决您的问题,而无需使用诸如chmod这样的命令:

  • CHOWN_HOME=yes
  • CHOWN_HOME_OPTS='-R'