将gcloud与docker一起使用

时间:2016-08-16 23:19:21

标签: bash docker docker-compose

尝试将gsutil安装到容器中以备份到Google云存储中。当我手动将东西安装到容器中时,它可以正常工作,但是当尝试使用构建自动化时,我会继续bash: gcloud: command not found我做错了什么?

##Dockerfile##

FROM node:5

#RUN rm /bin/sh && ln -s /bin/bash /bin/sh

RUN apt-get update

RUN curl https://sdk.cloud.google.com | bash

RUN /bin/bash -c "exec -l $SHELL"

ADD ./ /src

RUN /bin/bash -c "source ~/.bashrc"

CMD ["/bin/bash"]


###docker-compose.yml##

backup:
  build: .
  volumes:
   - ./auth.json:/auth.json
  container_name: backups
  command: bash -c "gcloud auth activate-service-account --key-file     /auth.json"

现在我正在运行docker-compose build&完成后docker-compose up

1 个答案:

答案 0 :(得分:0)

你忘了文件路径中的点, 尝试使用此命令:

gcloud auth activate-service-account --key-file     ./auth.json
相关问题