我想在某个路径下创建文件。正在使用的docker镜像来自文件:
singleuser:
image:
# Get the latest image tag at:
# https://hub.docker.com/r/jupyter/datascience-notebook/tags/
# Inspect the Dockerfile at:
# https://github.com/jupyter/docker-stacks/tree/master/datascience-notebook/Dockerfile
name: jupyter/datascience-notebook
tag: 177037d09156
以上yaml取自此处:https://zero-to-jupyterhub.readthedocs.io/en/latest/user-environment.html
JuPyterHub为方案singleUser
中的每个用户创建一个新的pod。我要在创建新卷后立即创建文件。
我尝试阅读文档和其他相关问题,但没有一个解决这个问题。
下面是定义存储逻辑的代码段。每个用户都会得到一个新的pvc,我想在创建该pvc时创建一个新文件。下面的代码段中已经有homeMountPath和用户名,我不知道如何写文件-类似于echo "run_id = 'sample' " > /home/jovyan/username/.ipython/profile_default/startup/aviral.py
storage:
type: dynamic
extraLabels: {}
extraVolumes: []
extraVolumeMounts: []
static:
pvcName:
subPath: '{username}'
capacity: 10Gi
homeMountPath: /home/jovyan
dynamic:
storageClass:
pvcNameTemplate: claim-{username}{servername}
volumeNameTemplate: volume-{username}{servername}
storageAccessModes: [ReadWriteOnce]
完整的头盔图表可在此处找到,官方的头盔图表为:https://jupyterhub.github.io/helm-chart/jupyterhub-0.8.2.tgz
我希望在命名空间jhub
中创建吊舱时,已经创建了一个文件。
答案 0 :(得分:3)
您可以查看configmap对象。可以将configmap中的文件作为卷装入容器中。