Docker:通过.ENV文件访问JSON文件
我目前正试图在我的Jupyter笔记本中设置谷歌云。整个设置是用Docker完成的 .env(见附件) 我的Dockerfile当前看起来像:Docker:通过.ENV文件访问JSON文件,docker,google-cloud-platform,Docker,Google Cloud Platform,我目前正试图在我的Jupyter笔记本中设置谷歌云。整个设置是用Docker完成的 .env(见附件) 我的Dockerfile当前看起来像: FROM jupyter/scipy-notebook RUN conda install --yes -c conda-forge fbprophet ENV PATH "$PATH:/home/jovyan/.local/bin" RUN pip install awscli --upgrade --user # Install from req
FROM jupyter/scipy-notebook
RUN conda install --yes -c conda-forge fbprophet
ENV PATH "$PATH:/home/jovyan/.local/bin"
RUN pip install awscli --upgrade --user
# Install from requirements.txt file
COPY requirements.txt /tmp/
RUN pip install --requirement /tmp/requirements.txt && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER
现在我尝试将复制Natural-Language-96a3b12743a0.json.
添加到我的Dockerfile中。然而,我总是得到chgrp:changing'Natural-Language-96a3b12743a0.json'组:不允许操作
我将.ENV文件更改为以下内容:GOOGLE\u APPLICATION\u CREDENTIALS=“Natural-Language-96a3b12743a0.json”
但是当我在Python noteboook中运行代码时,我总是看到DefaultCredentialsError:找不到文件“Natural-Language-96a3b12743a0.json”。
你知道我做错了什么吗?如果你已经用正确的权限创建了服务帐户并下载了.json文件
尝试添加对该文件的权限
sudo chmod 755 Natural-Language-96a3b12743a0.json
并将完整路径添加到文件
GOOGLE_APPLICATION_CREDENTIALS=“/root/path/to/Natural-Language-96a3b12743a0.json
FROM jupyter/scipy-notebook
RUN conda install --yes -c conda-forge fbprophet
ENV PATH "$PATH:/home/jovyan/.local/bin"
RUN pip install awscli --upgrade --user
# Install from requirements.txt file
COPY requirements.txt /tmp/
RUN pip install --requirement /tmp/requirements.txt && \
fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER