使用 Kubeflow jupyter 默认界面创建自定义镜像

Create custom image with Kubeflow jupyter default interface

我想知道如何使用 kubeflow 安装默认的启动器界面创建自定义 jupyter 图像。

按照官方 kubeflow 文档中的教程,我能够使用默认的 jupyter 界面生成自定义图像。

但我想用 kubeflow jupyter default interface:

创建

我找不到使用此 link 基础图像的教程,即具有修改界面的图像:

我也尝试使用 this link 中包含的图像作为基础图像,命名为 jupyter-web-app,但在将 jupyter 笔记本服务器指向开始指向这张图片,我只收到错误:'no healthy upstream' 它根本没有加载。

我认为这与它启动容器的方式有关,不同于kubeflow documentation创建自定义图像:

文档说明它应该包含这个默认的 CMD:

ENV NB_PREFIX /

CMD ["sh","-c", "jupyter notebook --notebook-dir=/home/jovyan --ip=0.0.0.0 --no-browser --allow-root --port=8888 --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*' --NotebookApp.base_url=${NB_PREFIX}"]

jupyter-web-app 有:

ENTRYPOINT ["python3"]
CMD ["main.py"]

是否有一个基础镜像可以使用 jupyter kubeflow 默认界面构建我的自定义镜像? (我知道在功能方面他们做同样的工作,但这是为了可用性[不要破坏用户体验])。

这是我的 Dockerfile:

# Base image Dockerfile (AWS Deep Learning Containers)
# https://github.com/aws/deep-learning-containers/blob/master/tensorflow/training/docker/2.2.0/py3/Dockerfile.cpu

FROM gcr.io/kubeflow-images-public/tensorflow-1.15.2-notebook-cpu@sha256:87c49f386263b8b3f4ba104617b888a97dad4dd166984c1e1d679435f1763ba1

# Install python3 packages from requirements file. Don’t install package dependencies.
# Run 'pip3 check' to verify if installed packages have compatible dependencies.
COPY requirements.txt /tmp

RUN pip3 --no-cache-dir install --no-deps --requirement /tmp/requirements.txt && \
    pip3 check || true

COPY custom_ssh_key /home/root/.ssh/id_rsa
COPY custom_ssh_key.pub /home/root/.ssh/id_rsa.pub

WORKDIR /root
ENV NB_PREFIX /
ENTRYPOINT ["tini", "--"]

CMD ["sh","-c", "jupyter notebook --notebook-dir=/home/${NB_USER} --ip=0.0.0.0 --no-browser --allow-root --port=8888 --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*' --NotebookApp.base_url=${NB_PREFIX}"]

使用这个 Dockerfile 我能够生成工作图像,但我想更改默认界面。

当我尝试使用此 link 中的 aws 优化图像时,出现 401 错误:

failed to solve with frontend dockerfile.v0: failed to create LLB definition: unexpected status code [manifests 1.2.0]: 401 Unauthorized

仅将 dockerfile FROM 命令更改为:

FROM 527798164940.dkr.ecr.us-west-2.amazonaws.com/tensorflow-1.15.2-notebook-cpu:1.2.0

我在 Github 的官方 kubeflow 项目中打开了 same question

DavidSpek 回答了这个问题

要生成具有我需要的界面的图像,我只需更改 Dockerfile 的最后一行。

CMD ["sh","-c", "jupyter lab --notebook-dir=/home/${NB_USER} --ip=0.0.0.0 --no-browser --allow-root --port=8888 --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*' --NotebookApp.base_url=${NB_PREFIX}"]

它解决了我的问题。