【问题标题】:How to pass argument for a configuration file in JuPyterhub's deployment?如何在 JuPyterhub 的部署中为配置文件传递参数?
【发布时间】:2019-10-07 14:43:29
【问题描述】:

我想在我的 docker 镜像中安装 envkey,这需要一对 key-value。我有 key-value 对,但我无法弄清楚如何使用这些参数将它安装在我的 docker 映像中,然后在 jupyterhub 上部署它。

我尝试阅读我使用envkey 的其他部署。这是怎么回事: 1. 我有一个Makefile,我运行命令sudo make dev config=aviral.cfg 2、Makefile中的dev命令如下:

dev:
    docker build -t $(IMAGE) -f Dockerfile.dev . && docker tag $(IMAGE) $(ALIAS)
    @echo "\nCreate docker container.."
    CONFIG=$(config) IMAGE=$(IMAGE) docker-compose -f docker-compose.yml up -d --scale test=0 --scale airflow_worker=0
    @echo "\n$(GREEN)Done.$(NO_COLOR)\n"
    @echo "Try airflow at http://localhost:8080."
    @echo "and flower at http://localhost:5555."

  1. docker-compose 文件是:
airflow_worker:
        image: ${IMAGE}:latest
        restart: always
        depends_on:
            - airflow_scheduler
        # ports:
        #     - 8793:8793
        # environment:
            # - GOOGLE_APPLICATION_CREDENTIALS=/gcloud/cloud.json
        env_file:
            - ${CONFIG}
        command: worker

如您所见,env_file 被传递。

我无法推断如何在 JuPyterHub 中执行此操作。

舵图在这里(https://jupyterhub.github.io/helm-chart/jupyterhub-0.8.2.tgz)。我的配置是:

proxy:
  secretToken: "yada_yada"
singleuser:
  image:
    name: yada_yada.dkr.ecr.ap-south-1.amazonaws.com/demo
    tag: 12h
  lifecycleHooks:
    postStart:
      exec:
        command: ["/bin/sh", "-c", 'ipython profile create; cd ~/.ipython/profile_default/startup; echo ''run_id = "sample" ''> aviral.py']
  imagePullSecret:
    enabled: true
    registry: yada_yada.dkr.ecr.ap-south-1.amazonaws.com
    username: aws
    email: aviral@yada_yada.com
    password: yada_yada

在我的配置文件中,我将变量传递为:

ENVKEY=my_personal_envkey

我希望在 docker 中传递我的配置,或者我可能为这些东西编写了一个适当的 Makefile,到目前为止,我正面临这个错误:

Step 19/32 : RUN     curl -s https://raw.githubusercontent.com/envkey/envkey-source/master/install.sh | bash
 ---> Running in 35bc1cf0e1c8
envkey-source 1.2.9 Quick Install
Copyright (c) 2019 Envkey Inc. - MIT License
https://github.com/envkey/envkey-source

Downloading envkey-source binary for linux-amd64
Downloading tarball from https://github.com/envkey/envkey-source/releases/download/v1.2.9/envkey-source_1.2.9_linux_amd64.tar.gz
envkey-source is installed in /usr/local/bin
Installation complete. Info:

bash: line 97:    29 Segmentation fault      envkey-source -h
The command '/bin/sh -c curl -s https://raw.githubusercontent.com/envkey/envkey-source/master/install.sh | bash' returned a non-zero code: 139

虽然这个问题本身就足以为您提供图片,但为了上下文(如果),这里有一些问题: 1.How do I make jupyter-hub access my private docker image repository? 2.Unable to run a lifecycle command from config.yaml while deploying jupyterhub 3.How to have file written automatically in the startup folder when a new user signs up/in on JuPyter hub?

【问题讨论】:

    标签: docker kubernetes docker-compose kubernetes-helm jupyterhub


    【解决方案1】:

    您可能会收到此错误,因为 install.sh 脚本尝试在 /usr/local/bin 目录下添加 envkey-source 二进制文件,然后尝试运行 envkey-source -h 并失败。检查用户(如果非 root)是否有权执行此操作,或者容器映像中是否存在 /usr/local/bin 目录。

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-12
      • 1970-01-01
      • 2020-01-31
      • 1970-01-01
      • 1970-01-01
      • 2015-01-13
      • 2019-10-21
      • 2022-07-06
      相关资源
      最近更新 更多