如何在 Docker 镜像中安装 Google Cloud SDK? [英] How to install the Google Cloud SDK in a Docker Image?
本文介绍了如何在 Docker 镜像中安装 Google Cloud SDK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 Google 的云命令行工具/SDK 构建 Docker 容器?
How can I build a Docker container with Google's Cloud Command Line Tool/SDK?
网址 https://sdk.cloud.google.com 处的脚本似乎需要用户输入所以在 docker 文件中不起作用.
The script at the url https://sdk.cloud.google.com appears to require user input so doesn't work in a docker file.
推荐答案
将以下内容添加到我的 Docker 文件似乎有效.
Adding the following to my Docker file appears to work.
# Downloading gcloud package
RUN curl https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz > /tmp/google-cloud-sdk.tar.gz
# Installing the package
RUN mkdir -p /usr/local/gcloud
&& tar -C /usr/local/gcloud -xvf /tmp/google-cloud-sdk.tar.gz
&& /usr/local/gcloud/google-cloud-sdk/install.sh
# Adding the package path to local
ENV PATH $PATH:/usr/local/gcloud/google-cloud-sdk/bin
这篇关于如何在 Docker 镜像中安装 Google Cloud SDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文