如何在JuPyterhub的部署中为配置文件传递参数?

时间:2019-05-21 08:36:45

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

我想在需要envkey对的docker映像中安装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?

1 个答案:

答案 0 :(得分:0)

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

希望有帮助!